TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Darin McBride
from: Denis Tonn
date: 1996-06-21 19:15:04
subject: semaphore

Original from  Darin McBride  to Daniel Lynes on 06-19-1996
Original Subject: semaphore

                         ---------------------------------------

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

 There are global semaphores designed for interprocess, and local 
semaphores designed for interthread. They are almost exactly the same 
except for the "availability" outside the process for a global one. 

 EnterCritSec is OK if your app does not have many threads (2-3 max). 
If you have more than that, then you should use semaphores (local). 
Critcal sections will stop ALL other threads in your process from 
running, when most times all you need is to protect a single resource. 

 CritSec is useless if you are working in a multiple process
enviroment. 


   Denis       

 Certified OS/2 Engineer, Certified OS/2 Instructor, Certifiable....
 All opinions are my very own, IBM has no claim upon them
 
.
--- Maximus/2 3.01
* Origin: T-Board - (604) 591-8208 (1:153/908)
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: 153/908 8086 800 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™.