Browse Prior Art Database

A way to manage threads detachment

IP.com Disclosure Number: IPCOM000033276D
Original Publication Date: 2004-Dec-03
Included in the Prior Art Database: 2004-Dec-03
Document File: 2 page(s) / 43K

Publishing Venue

IBM

Abstract

A method for detaching threads asynchronously, avoiding waste of time in monitoring the thread ending if not strictly necessary.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 100% of the total text.

Page 1 of 2

A way to manage threads detachment

A method is disclosed that allows detaching a thread asynchronously.

    Thread detaching is necessary to free the resources allocated for the threads and to reset the number of active threads; this number is limited by a customizable system parameter.

    The usual way to manage a thread is to create it, join it and detach the thread after its exit.

This synchronous solution is not valid if an application starts several threads that work concurrently and can finish in a not specific order.

    In order to work asynchronously it is necessary to find a way to monitor the thread exiting. The following method allows performing this monitoring only when really required, avoiding waste of time. The idea is to maintain a list of created threads containing the thread identifier and the thread status. Each thread update this status before exiting. Each time a process (or a thread) must create a new thread, it checks the list and detaches all threads with a 'exited' status.

    This idea prevents the application from getting an error in thread creation caused by the maximum number of active threads already reached because some threads are exited but not detached, without impacting performances with unnecessary monitoring.

    You can refer to the Figure below for an example of how applying this method in a process that creates threads that work concurrently.

1

Page 2 of 2

2

[This page contains 2 pictures or other non-text objects]