mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
add Limbo: language, samples
This commit is contained in:
26
samples/Limbo/lock.b
Normal file
26
samples/Limbo/lock.b
Normal file
@@ -0,0 +1,26 @@
|
||||
implement Lock;
|
||||
|
||||
include "sys.m";
|
||||
sys: Sys;
|
||||
include "lock.m";
|
||||
|
||||
Semaphore.obtain(l: self ref Semaphore)
|
||||
{
|
||||
l.c <-= 0;
|
||||
}
|
||||
|
||||
Semaphore.release(l: self ref Semaphore)
|
||||
{
|
||||
<-l.c;
|
||||
}
|
||||
|
||||
Semaphore.new(): ref Semaphore
|
||||
{
|
||||
l := ref Semaphore;
|
||||
l.c = chan[1] of int;
|
||||
return l;
|
||||
}
|
||||
|
||||
init()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user