added some code to implement semaphores
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
#class Delay(Object)
|
||||
{
|
||||
## TODO: support milliseconds or nanoseconds
|
||||
@ -26,7 +28,7 @@
|
||||
|
||||
#class(#pointer) Process(Object)
|
||||
{
|
||||
#dcl initial active state prev next sp.
|
||||
#dcl initial_context runnable_context state prev next sp sem_next.
|
||||
|
||||
#method new
|
||||
{
|
||||
@ -71,6 +73,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
#class Semaphore(Object)
|
||||
{
|
||||
#dcl count waiting_head waiting_tail.
|
||||
|
||||
#method initialize
|
||||
{
|
||||
}
|
||||
|
||||
#method signal
|
||||
{
|
||||
<primitive: #_semaphore_signal>
|
||||
self primitiveFailed.
|
||||
}
|
||||
|
||||
#method wait
|
||||
{
|
||||
<primitive: #_semaphore_wait>
|
||||
self primitiveFailed.
|
||||
}
|
||||
}
|
||||
|
||||
#class ProcessScheduler(Object)
|
||||
{
|
||||
#dcl tally head tail active.
|
||||
|
Reference in New Issue
Block a user