A "sleep" command without "receive"

Corrado Santoro <>
Mon Feb 2 10:27:32 CET 2004


Hi all, 
I've seen that to wait a timeout the statements I've to use are: 
 
receive 
  after T-> ok 
end 
 
I've also seen that timer:sleep/1 implements the same routine... but... 
I use this timeout in a process that, after the timeout, receives something 
from another process. If the sending process sends data before the receiving 
process calls timer:sleep, the latter function returns immediatelly, picking 
also the message. This is *not* the behaviour I want to implement. 
 
The problem is, obviously, that there is a "receive" statement in timer:sleep 
that "steals" incoming messages. 
 
Do you know how to wait a timeout without using "receive"? 
 
Bye, 
-Corrado 
 
--  
====================================================== 
Eng. Corrado Santoro, Ph.D. 
 
University of Catania - Engineering Faculty 
Department of Computer Science and 
Telecommunications Engineering 
Viale A. Doria, 6 - 95125 CATANIA (ITALY) 
 
Tel: +39 095 7382364           Fax: +39 095 338280 
     +39 095 7382365 
     +39 095 7382380 
 
EMail:  
Personal Home Page: 
            http://www.diit.unict.it/users/csanto 
 
NUXI Home Page: 
            http://nuxi.iit.unict.it 
====================================================== 

-------------------------------------------------
This mail sent through IMP: http://www.cdc.unict.it/



More information about the erlang-questions mailing list