Browse Prior Art Database

Thread Termination Enhancements

IP.com Disclosure Number: IPCOM000121590D
Original Publication Date: 1991-Sep-01
Included in the Prior Art Database: 2005-Apr-03
Document File: 3 page(s) / 114K

Publishing Venue

IBM

Related People

Cook, RL: AUTHOR [+2]

Abstract

This article describes two techniques for use in a personal computer (PC) to detect thread termination and to allow an action to be taken on behalf of the terminating thread.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 44% of the total text.

Thread Termination Enhancements

      This article describes two techniques for use in a
personal computer (PC) to detect thread termination and to allow an
action to be taken on behalf of the terminating thread.

      In a 16-bit operating system (OS) multi-threaded process model,
each thread of execution shares the process's resources.  Threads are
the dispatchable entity of the system, and are created using either
the DosExecPgm application program interface (API) (when starting a
process) or the DosCreateThread API.  The DosExit API is used to
terminate a process and all of its threads, or to terminate the
current thread.  A thread can also be terminated when some thread in
a process causes an exception whose default action is to terminate
the process and its associated threads.  Therefore, a thread can be
terminated voluntarily or involuntarily.

      Since the system provides no API for waiting on the termination
of a thread in a process, resources allocated by subsystems and
programs on a per thread basis cannot properly be freed when the
thread terminates.

      Two techniques are disclosed herein for detecting thread
termination and allowing an action to be taken on behalf of the
terminating thread.  They are as follows:
      o   A new API called DosWaitThread that allows a
          thread to wait on any thread's termination or a
          specific thread's termination.  The API can be
          called in both a blocking and non- blocking mode
          to allow the caller flexibility in his own thread
          management.
      o   A new exception called the ProcessTermination
          exception.  Since the exception architecture
          tracks and dispatches exceptions on a thread
          basis, an exception has been defined that is
          raised when the thread is terminated, whether it
          is synchronously or asynchronously.
      o   The DosWaitThread API is used to manage threads
          within a process that are closely associated.
          Typically a process might have a single master
          thread that spawns other threads to do work and
          manages the other thread's resources.
          DosWaitThread could also be used by a subsystem
          that needs to create a thread in the requestor's
          process to do some work.  The API works in both
          thread id specific and nonspecific
          modes so that one may wait on any thread to
          terminate or a specific one created to do a
          specific task.  This API does not "hold" a
          thread's termination until it is called, like the
          DosWaitChild API.  If a thread terminates before
          DosWaitThread is issued for that thread, the API
   ...