Jump to content

DosFreeSpinLock: Difference between revisions

From EDM2
Erdmann (talk | contribs)
No edit summary
Erdmann (talk | contribs)
No edit summary
Line 5: Line 5:


==Parameters==
==Parameters==
; Handle : A handle to a spinlock. This handle was returned on the DosCreateSpinLock api call.
;Handle ([[HSPINLOCK]]):A handle to a spinlock. This handle was returned on the DosCreateSpinLock api call.


==Return Code==
==Return Code==

Revision as of 10:07, 19 July 2023

Free a spinlock for multiprocessor serialization.

Syntax

APIRET APIENTRY DosFreeSpinLock (HSPINLOCK Handle)

Parameters

Handle (HSPINLOCK)
A handle to a spinlock. This handle was returned on the DosCreateSpinLock api call.

Return Code

  • NO_ERROR
  • ERROR_INVALID_HANDLE

Remarks

DosFreeSpinLock is passed the handle which was returned by DosCreateSpinLock.

Example Code

#define INCL_DOSSPINLOCK
 #include <os2.h>
 HSPINLOCK hspin;
 
 thread1() {
   //acquire spinlock
   DosAcquireSpinLock(hspin);
   //do something that only takes a few microseconds
   ...
   //release spinlock
   DosReleaseSpinLock(hspin);
 }
 
 void main() {
   //create spinlock
   DosCreateSpinLock(&hspin);
   //do something
   ...
   //destroy spinlock
   DosFreeSpinLock(hspin);
 }

Related Functions