![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How many semaphores? | Watto86 | UNIX for Advanced & Expert Users | 8 | 11-07-2007 09:32 PM |
| semaphores | kekanap | Shell Programming and Scripting | 1 | 03-27-2007 02:56 AM |
| semaphores | qntmteleporter | High Level Programming | 2 | 01-28-2006 04:10 PM |
| Semaphores with key of 0 | doeboy | UNIX for Advanced & Expert Users | 0 | 10-28-2004 12:41 PM |
| Semaphores | joseph_shibu | High Level Programming | 1 | 11-01-2001 09:01 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
semaphores using up and down
been searching around on how to use an up and down function with semaphores but i can't find an example. i looked into using: "semop" but i have no idea how to use it. I have been able to declared the semaphores using semget and initializing them using semctl.
|
| Forum Sponsor | ||
|
|
|
|||
|
sorry, forgot to update this. i found out that i needed to create a stuct that would implement the function i wanted. increment the semaphore by 1 or decrease it by 1.
here is where i got the idea http://docs.linux.cz/programming/c/u...les/semab.html |
|
|||
|
what i did was just define a number of KEYs equal to the number of semaphores i wanted and then i created 2 struct to create the functions up and down. i didn't use a void main, just main. Why would void main be bad?
you have to release the resources??? how do you do that? aren't they released as soon as the program is done? |