Mutex: Difference between revisions

409 bytes added ,  11 years ago
Added BBC BASIC
No edit summary
(Added BBC BASIC)
Line 62:
end;</lang>
It is also possible to implement mutex as a monitor task.
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<lang bbcbasic> REM Create mutex:
SYS "CreateMutex", 0, 0, 0 TO hMutex%
REM Wait to acquire mutex:
REPEAT
SYS "WaitForSingleObject", hMutex%, 1 TO res%
UNTIL res% = 0
REM Release mutex:
SYS "ReleaseMutex", hMutex%
REM Free mutex:
SYS "CloseHandle", hMutex%</lang>
 
=={{header|C}}==