smc%infidel@LANL.GOV (Susan Coghlan) (07/19/90)
Help! Does anyone know why awaitevent would NOT block a process until an event was received? for instance in the section of code below: createevent dup /Name /SPDone put expressinterest { awaitevent dup /Name get /SPDone eq {exit}{pop}ifelse } loop this crashes on " /Name get " because there is no event on the stack! In fact, the event in which interest had been expressed hadn't even occurred when it crashed. Ok, so something weird is happening - let's check the type of the top item on the stack after awaitevent, print it's type, and then loop until an event is left on it. Here's the code: createevent dup /Name /SPDone put expressinterest { awaitevent % generate a message to the message window dup type 20 string cvs (Type: ) exch append (Event Received) 2 SendMessage % check type of event and exit the loop if the % right event dup type /eventtype eq { dup /Name get /SPDone eq {exit}{pop}ifelse } if } loop so what happens? Not quite what you'd expect: before the sendevent code is executed a message is received: Event Received Type: Integer and then nothing - no more messages, doesn't exit the loop, it just hangs - as if awaiting an event - even though you send the correct event several times.... Any ideas? Other loops of this type seem to work at various other places in the code......... Susan Coghlan smc@infidel.lanl.gov