### Multithreaded Programs (OS/2)

Avoid using the following OS/2 API's in multithreaded programs:

- DosSuspendThread: Do not suspend a thread that owns a semaphore, or you will prevent any thread needing that semaphore from continuing.
- DosKillThread: Do not kill a thread that owns a semaphore, or the semaphore will go into an error state "Owner died".

In both cases you should notify the thread you want to kill or suspend, and have that thread do the killing or suspending itself after it has done any necessary cleanup.

When you are using semaphores, always check the return code for DosGetSemaphore to make sure the owner hasn't died, or you may lock a thread waiting for a semaphore that will never be freed.

Debugging Threads