TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Daniel Lynes
from: Darin McBride
date: 1996-06-19 19:24:16
subject: semaphore

Greetings, Daniel

Replying to a message of Daniel Lynes to Francois Thunus:

 DL> Hello Francois!

 DL> 16 Jun 96 21:48, Francois Thunus wrote to All:

 FT>> way to do this without consuming any resources ? the doc talks
 FT>> about threads for the muxwait, which is why I am not sure I can
 FT>> use it between 2 apps.

 DL> The semaphores are designed for threads; I'm not sure if you can use
 DL> them for inter-process communications or not, just inter-thread
 DL> communications.

Semaphores are designed for inter-process, not inter-thread.  Since they
are globally available, threads may use them, but just as often, critical
sections may be used to a greater efficiency as they have lower overhead
(if they are the same as the WinNT versions of these functions, which is
likely considering their common base).

 DL> However, you might try using a duplex pipe, or creating a 0 byte file
 DL> at the outset; if that 0 byte file exists, a process has started up;
 DL> else, go ahead and run.  This is the way I've got
 DL> BinkleyTerm/Squish/Maximus configured, to avoid having more than one
 DL> program writing to the message base at once (Maximus does it
 DL> automatically, but GoldEd/2 doesn't, so I need to create a tag file,
 DL> so that when an import/export starts running, it checks for the tag
 DL> file first, before invoking squish.)

GoldEd/2's scan of the bases will not harm the bases if another process is
working with them.  Max and Squish use semaphores (BBSSEM's environment
variable, otherwise /sem/squish/default) to lock the bases.  The only
"harm" comes from writing in GoldEd/2 while tossing is going on
in the same area.  (This includes editing the message to write while
tossing happens in that area.)  However, no long-term harm erupts ... it
won't even require sqfix to be executed.

Until next time,
Darin McBride

--- FleetStreet 1.16 NR
* Origin: Tanktalus' Tower BBS/RPGs Galore! (1:342/1000)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1
@PATH: 342/5015 61 3615/50 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™.