ets weirdness when using -run

Matthias Lang matthias@REDACTED
Thu Jun 20 08:35:04 CEST 2002


Shawn Pearce writes:

 > wait_forever() ->
 > 	receive
 > 		stop ->
 > 			done
 > 	end,
 > 	wait_forever().
 > 
 > This way you can request that the process terminate by sending it
 > a 'stop' message:
 > 
 > 	ProcessPid ! stop

The final recursive call to wait_forever() defeats the stop
mechanism. Maybe you meant

 wait_forever() ->
 	receive
 		stop ->
 			done;
		X ->
			io:fwrite("~p: unexpected: ~p\n",[self(), X]),
		 	wait_forever()
 	end.

Matt



More information about the erlang-questions mailing list