_syncthread

Waits for a thread to finish processing.

int _syncthread (int handle);

int syncthread (int handle);

Required Header
<process.h>

Return Value

The return value from the ended thread. -1 indicates an error.

Parameters

handle

  The handle returned from _beginthread

Remarks

The _syncthread function waits for a thread to finish and returns the threads return code. The resources used by the thread are made available again to new calls to _beginthread.

Without calling _syncthread the resources must be left unused by the JCC library in case a later call is made to obtain the threads return code long after the thread finishes.

Warning: the return value is a 30 bit signed integer which is sign-extended to 32 bits on return. Do not use a cast to convert this number into a pointer, unless the memory area used is a 24 bit address. This is due to an operating system limitation in the Event Control Block.

Process and Threads

See Also    _endthread, _beginthread, _threadpriority, _threadstatus