Mercurial > hg > reactive
comparison qutils.pl @ 15:c91d53b19dbb tip
Meh?
author | samer |
---|---|
date | Wed, 19 Dec 2012 19:16:30 +0000 |
parents | 44417282afec 02d99048fb78 |
children |
comparison
equal
deleted
inserted
replaced
14:44417282afec | 15:c91d53b19dbb |
---|---|
33 %:- writeln('% compiling get_message_or_timeout/2 using deadline/1 option.'). | 33 %:- writeln('% compiling get_message_or_timeout/2 using deadline/1 option.'). |
34 | 34 |
35 :- if((current_prolog_flag(version,Version),Version<60102)). | 35 :- if((current_prolog_flag(version,Version),Version<60102)). |
36 | 36 |
37 get_message_or_timeout(Deadline,Msg) :- | 37 get_message_or_timeout(Deadline,Msg) :- |
38 ( get_time(Now), Now<Deadline | 38 thread_self(Thread), |
39 -> thread_self(Thread), | 39 ( thread_get_message(Thread,Msg,[deadline(Deadline)]) |
40 thread_get_message(Thread,Msg,[deadline(Deadline)]), | 40 -> debug(qutils,'got message: ~w.',[Msg]) |
41 debug(qutils,'got message: ~w.',[Msg]) | 41 ; Msg=timeout). |
42 ; Msg=timeout | 42 |
43 ). | 43 % ( get_time(Now), Now<Deadline |
44 % -> thread_self(Thread), | |
45 % thread_get_message(Thread,Msg,[deadline(Deadline)]), | |
46 % debug(qutils,'got message: ~w.',[Msg]) | |
47 % ; Msg=timeout | |
48 % ). | |
44 | 49 |
45 :- else. | 50 :- else. |
46 | 51 |
47 get_message_or_timeout(Deadline,Msg) :- | 52 get_message_or_timeout(Deadline,Msg) :- |
48 thread_self(Thread), | 53 thread_self(Thread), |