[Coco] Semaphores in OS-9/6809?

John R. Hogerhuis jhoger at pobox.com
Fri Sep 24 20:24:20 EDT 2004


Whenever I've written simple critical sections in C, it's just macros

CRT_ENTER (cntr)
CRT_LEAVE (cntr)

where CRT_ENTER disables interrupts and increments the counter.

CRT_LEAVE decrements the counter. If it becomes zero, it enables
interrupts.

This way if you have two critical sections and invokes the other,
everything will still work properly.

This kind of critical section has to be very short of course since
interrupts are disabled for the duration. But higher level
synchronization primitives can be based on it.

-- John.





More information about the Coco mailing list