# HG changeset patch # User samer # Date 1329151236 0 # Node ID 99572a386ccf4ca7b42b290ed403864617702f99 # Parent ef5802225f9912d14989dcc4677ce95d894cc9e3 Removed with_message and with_message_or_timeout diff -r ef5802225f99 -r 99572a386ccf qutils.pl --- a/qutils.pl Mon Feb 13 13:04:26 2012 +0000 +++ b/qutils.pl Mon Feb 13 16:40:36 2012 +0000 @@ -1,7 +1,5 @@ :- module( qutils, - [ with_message/2 - , with_message_or_timeout/4 - , get_message_or_timeout/2 + [ get_message_or_timeout/2 , send_with_size_limit/3 ]). @@ -63,38 +61,6 @@ :-endif. - -%% with_message( Msg, :Goal) is nondet. -% -% Waits for next message, unify with Msg, and call Goal. -% This procedure gets the next term out of the current thread's -% message queue, waiting if necessary. If it is 'quit', then -% it succeeds immediately leaving Msg unchanged. If it unifies -% with Msg, then Goal is called. Otherwise, a message is printed -% and the proceduce succeeds. -with_message(Temp,OnEvent) :- - thread_get_message(Msg), - ( Msg=quit -> true - ; Msg=Temp -> call(OnEvent) - ; writeln(template_mismatch(Temp,Msg)) - ). - -%% with_message_or_timeout( +TimeOut, Msg, :OnEvent, :OnTimeOut) is nondet. -% -% Time limited wait for message with handler goals for either case. -% Waits up to TimeOut seconds for next message, unify with Msg, -% and call OnEvent. If none arrives before TimeOut expires, -% OnTimeOut is called instead. If the message is 'quit', it -% just returns. If the message does not unify with Msg, some -% text is printed and the proceduce succeeds. -with_message_or_timeout(T,Temp,OnEvent,OnTimeout) :- - get_message_or_timeout(T,Msg), - ( Msg=quit -> true - ; Msg=timeout -> call(OnTimeout) - ; Msg=Temp -> call(OnEvent) - ; writeln(template_mismatch(Temp,Msg)) - ). - %% send_with_size_limit( +Max:natural, +Queue:queue_id, +Msg:term) is det. % % Adds term to message queue unless queue is already full.