This example stops the Workplace Shell DSOM Server, then waits until the server has terminate before stopping the DSOM daemon.
#define INCL_WPCLASS #include <os2.h> ULONG count=0; enum {OFF, ON}; WinRestartWPDServer(OFF); /* Make sure the server thread has terminated completely before */ /* bring down the DSOM daemon */ while ( WinIsWPDServerReady() ) { HEV hev; /* First create a private, reset, event semaphore. */ DosCreateEventSem( (PSZ)NULL, &hev, 0, FALSE); /* Wait for 1 second; then try again for a max. of 30 sec. */ DosWaitEventSem (hev, 1000); if (count++ > 30) break; } WinRestartSOMDD (OFF);