Description
#define INCL_BASE #define OS2_API16 #define INCL_DOSSPINLOCK #include <os2.h> #include <stdio.h> #include <string.h> main() { APIRET rc; /* Return code */ HSPINLOCK Handle; /* Handle to spin lock */ PHSPINLOCK pHandle = &Handle; /* pointer to spin lock handle */ /* Create a spin lock */ rc = DosCreateSpinLock(pHandle); if (rc !=0) { printf("DosCreateSpinLock failed -- rc = %1d",rc); DosExit(0,1); } /* Acquire spin lock */ rc = DosAcquireSpinLock(Handle); if (rc !=0) { printf("DosAcquireSpinLock failed -- rc = %1d",rc); DosExit(0,1); } /* Code that needs serialization */ /* Release spin lock */ rc = DosReleaseSpinLock(Handle); if (rc !=0) { printf("DosReleaseSpinLock failed -- rc = %1d",rc); DosExit(0,1); } /* Free spin lock */ rc = DosFreeSpinLock(Handle); if (rc !=0) { printf("DosFreeSpinLock failed -- rc = %1d",rc); DosExit(0,1); } }
New APIs are being introduced to provide support for the OS/2 SMP V2.11 performance monitor.