[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

568.0. "Wait for event flag to CLEAR" by WJG::GUINEAU () Wed Sep 30 1987 12:31




I have a process which creates a detached process and passes it
commands via a a global section.

the detached process simply waits for an event flag to set, indicating a 
command is in the section. Once it completes the command, it clears the
event flag, signalling the main process the command is complete.


Whats the best way to wait for an event flag to CLEAR?

I figure a crude way is:



while (sys$readef(,,) != SS$WASCLR)  /* No timeout check here for simplicity */
   sleep(some_small_time);


Is this ok? Seems like if the sleep time is too small, this loop will eat
CPU.

I need a SYS$WFEFCLR(efn)	(wait for event flag to CLEAR!)  :-)


T.RTitleUserPersonal
Name
DateLines
568.1CASEE::VANDENHEUVELHein, Valbonne.Wed Sep 30 1987 13:2917
    Standard problem.
    
    Pick you choice from some possible solutions.
    
    - Add second event flag to flag back.
    
    - Check our ENQ/DEQ possibilities.
    
    - Have the originaing process go to sleep ($HIBER)
      and WAKE it of in the server. Put the process ID
      in the global section, or in a logical name, or
      use a sub-process instead of a detachted process
      and use the parent ID.
    
    Have fun,
             Hein.