|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#9
|
||||
|
||||
|
Re: Semaphores and Synchronized's
Semaphores basically prevent critical regions from executing at the same time. The Synchronized class basically handles semGive() and semTake() automatically. To mark the start of a critical region, you use the macro CRITICAL_REGION(semID) and END_REGION, which automatically wraps the area of code in a Synchronized class. To create a semaphore ID, simply declare a SEM_ID. Any critical regions that you do not want to run at once should share the semaphore ID. No further configuration of the semaphore ID is needed unless you want to use an advanced type of semaphore (such as a counting semaphore). More information can be found here:
http://www.slac.stanford.edu/exp/gla...ef/semLib.html Last edited by slavik262 : 21-01-2009 at 20:55. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bill of Materials, do it and do it well, and bring it to your event | sanddrag | Rules/Strategy | 3 | 24-03-2006 21:09 |
| pic: Stars and Stripes over Einstein and Galileo | CD47-Bot | Extra Discussion | 6 | 01-05-2004 00:54 |