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: 
  after T-> ok 
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"? 
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 
Personal Home Page: 
NUXI Home Page: 

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

More information about the erlang-questions mailing list