ID Number: Q32057
5.10 6.00 6.00a
OS/2
Summary:
The _beginthread() and _endthread() functions are discussed in the
file MTDYNA.DOC in Microsoft C version 5.1, and in chapter 15 of the
"Microsoft C Advanced Programming Techniques" that shipped with
Microsoft C version 6.0.
The _beginthread() function should be used in place of
DosCreateThread() when coding multithreaded applications in C versions
5.1 and 6.0. The _endthread() function should be used rather than
DosExit() to terminate a thread before it runs to completion.
The _beginthread() function takes care of important thread-creation
tasks, such as the following:
- Initializing the per-thread floating-point package
- Saving/restoring the DGROUP environment
- Ensuring that there aren't too many threads being created
- Verifying the validity of the stack generated
The stack you pass to _beginthread() must meet the following
requirements:
- It must not have null segment.
- It must not start at an odd address.
- It must not have 0 length.
- It must not have an odd length.
- It must not extend past the end of the segment.
Because of the importance of these tasks, it is important to use
_beginthread()/_endthread() instead of DosCreateThread()/ DosExit()
when coding multithreaded applications in C version 5.1. Although you
may be able to use DosCreateThread(), consistent results are not
guaranteed.
Additional reference words: 5.10 6.00 6.00a