[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


C.5 Win32/DECthreads API Interoperability

Threads created by DECthreads are fully interoperable with the Win32 API and may create and use Win32 synchronization elements and other constructs. Threads created using the Win32 API routine, CreateThread(), may also create and use DECthreads (POSIX 1003.4a) synchronization elements and other constructs.

The first time a thread created using the Win32 API makes a call into the DECthreads API, it becomes registered with the DECthreads package and is allowed to make use of DECthreads primitives. This type of thread should not call pthread_exit() because Win32 API threads are not set up to exit like a DECthreads API thread.

DECthreads considers threads created by the Win32 API detached by default and does not allow any other thread to join it. However, any Win32 created thread can join a DECthreads API created thread.

Threads created using the C Run-Time Library function, _ beginthread(), will interoperate with DECthreads the same way as a thread created using the Win32 API routine, CreateThread().

DECthreads structured exception handling is interoperable with Microsoft C exception handling, but has slightly different syntax. DECthreads supports a different set of tokens for establishing exception blocks. The DECthreads tokens include TRY, CATCH, CATCH_ ALL, FINALLY and ENTRY. The Microsoft tokens include try and except. The DECthreads exception semantics support multiple catch clauses and provide support for creating unique (address) exceptions. For more information about using the DECthreads exception-handling package, see Chapter 5. See your Microsoft C documentation for Microsoft C exception-handling information.