Dec 182017
 
Windows 3.1 source code module to launch a child task and wait for it to terminate before executing specific code.
File TERMWAIT.ZIP from The Programmer’s Corner in
Category C Source Code
Windows 3.1 source code module to launch a child task and wait for it to terminate before executing specific code.
File Name File Size Zip Size Zip Type
CALLBACK.C 8173 2312 deflated
LEGAL.TXT 1889 916 deflated
README.TXT 1999 910 deflated
TERMWAIT.C 4887 1438 deflated
TERMWAIT.DEF 476 250 deflated
TERMWAIT.H 721 360 deflated
TERMWAIT.ICO 766 183 deflated
TERMWAIT.MAK 710 288 deflated
TERMWAIT.RC 1302 578 deflated
TERMWAIT.TXT 1997 910 deflated

Download File TERMWAIT.ZIP Here

Contents of the README.TXT file


TERMWAIT
--------

TERMWAIT demonstrates how to launch a child task and then wait for it
to terminate before executing specific code. Toolhelp library functions
are used for this purpose.

TERMWAIT requires 3.1 to build. However it has been compiled for
3.1 & 3.0 compatibility. TOOLHELP.DLL was not shipped with 3.0 and
consequently needs to be copied to the \windows\system directory
to run under 3.0.

TERMWAIT installs a notification call back function using NotifyRegister()
before calling WinExec() to launch the child task. All tasks in the system
will call this notification function before termination. The notification
function calls TaskFindHandle() to obtain TASKENTRY information about the
terminating task and consequently determines if the terminating task was
launched by TERMWAIT.

TERMWAIT sets the global variable bChildIsExecuting to TRUE when the child
task is spawned and sets it to FALSE after the child task has terminated.
Code that should not be executed while the child is running can check the
value of bChildIsExecuting. Menu choices that may cause rentrancy problems
during the wait should be grayed, The function AfterChildHasTerminated()
contains code that can be executed only after the child task has terminated.

If an application needs to keep track of a number of child tasks, it
can process both NFY_STARTTASK and NFY_ENDTASK in the NotifyRegister
callback function. GetCurrentTask() will return the task handle of
the task that called the notification. This information can be managed
by the parent task. Note that although no two tasks will have the same
task handle, it is possible for task handles to be reused. Consequently,
if one task terminates and another one starts, the new task can have the
same task handle as the task that just terminated. This is not a problem
if the parent task uses the NotifyRegister callback funtion to detect when
a task has terminated.









 December 18, 2017  Add comments

Leave a Reply