TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Darin McBride
from: Phil Crown
date: 1996-11-09 18:44:18
subject: Mutex semaphores

-=> Quoting Darin McBride to Phil Crown <=-

 DM> Ah, so you're using C++.  Couldn't tell.  :-)

 DM> BTW, your code had something like:  request.MutexSem() and
 DM> release.MutexSem().  Was this a typo?  I'm not sure how that could
 DM> work.

That was a typo/pseudo-code to illustrate the problem.

 DM> ULONG someFn()
 DM> {
 DM> static MutexSem ms;
 DM> if (!ms) // if this is the first call...
 DM> {
 DM> if (!ms.Open("someFn.SEM"))
 DM> {
 DM> return NO_SEM;
 DM> }
 DM> }

Good idea!  Mario Semo posted something similiar to this.

 DM> I'll be adding one more class so you can have:

 DM> DoSem ds(ms);

 DM> ...

 DM> return rc; // ~DoSem will release the sem AFTER the return value is
 DM> set! }

 DM> Interested?  :-)

I'm using Cubus OS/2 Class Library which has all the semaphores
encapsulated.  Its a freeware class lib with full-source code
available, and supports all the major OS/2 compilers.

See my page below for more...

Phil Crown
pcrown{at}airmail.net
http://web2.airmail.net/pcrown/

--- Blue Wave/OS2 v2.30
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 124/1208 1 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.