DosRequestRamSem obtains a RAM semaphore. This is used at the entry to a range of code that must not be executed simultaneously in multiple threads.
#define INCL_DOSSEMAPHORES #include <os2.h> PRAMSEM pramsem; /* Pointer to the RAM semaphore structure. */ LONG timeout; APIRET rc; /* Return code. */ rc = DosRequestRamSem(pramsem, timeout);