Thread View: comp.os.os2.programmer
3 messages
3 total messages
Started by Gary Kushner
Wed, 21 Nov 1990 23:17
Counting SEMs in OS/2?!?
Author: Gary Kushner
Date: Wed, 21 Nov 1990 23:17
Date: Wed, 21 Nov 1990 23:17
13 lines
980 bytes
980 bytes
Does anyone know if there are counting semaphores in OS/2 version 1.2?? I have a resource that can have multiple users, I want to use a counting semaphore to control access. I would like to be able to DosSemClear() the semaphore N times, and then other processes could DosSemRequest() the semaphore that number of times without being blocked. Can this be done? (There should be an <easy> way!) I would be very appreciative if someone could post or send me the answer! Thanks, -Gary
Re: Counting SEMs in OS/2?!?
Author: Frank Fuchs
Date: Mon, 26 Nov 1990 22:36
Date: Mon, 26 Nov 1990 22:36
17 lines
1298 bytes
1298 bytes
In article <8201@dog.ee.lbl.gov> kushner@ux5.lbl.gov (Gary Kushner) writes: >Does anyone know if there are counting semaphores in OS/2 version >1.2?? I have a resource that can have multiple users, I want to >use a counting semaphore to control access. I would like to be >able to DosSemClear() the semaphore N times, and then other >processes could DosSemRequest() the semaphore that number of times >without being blocked. > private system semaphores (DosCreateSem with parameter CSEM_PRIVATE) have to be cleared as many times as they have been set. The reason for this was that you should be able to write recursive functions that request ownership of a resource in each recursion level and free the resource every time they 'return'. Bye, -- Fealon, a.k.a. Frank Fuchs (Foxware), fealon@nadia.stgt.sub.org
Re: Counting SEMs in OS/2?!?
Author: Gary Kushner
Date: Sun, 02 Dec 1990 00:02
Date: Sun, 02 Dec 1990 00:02
16 lines
1424 bytes
1424 bytes
>private system semaphores (DosCreateSem with parameter CSEM_PRIVATE) have to be >cleared as many times as they have been set. The reason for this was that you >should be able to write recursive functions that request ownership of a >resource in each recursion level and free the resource every time they 'return'. Actually what I meant was more like the traditional P and V operations. I wanted to be able to initialize a SEM to a count and then have threads be able to P (request) the sem as many times as the original count. Used for controlling resources that can have more than one and less than all users. It turned out the code to implement counting semaphores in OS/2 was quite trivial. It is just to bad that Microsoft didn't include them in the first place. -Gary
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads