Changeset 4305
- Timestamp:
- 06/08/08 10:03:53 (4 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
compiler/logtalk.pl (modified) (8 diffs)
-
RELEASE_NOTES.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4304 r4305 7409 7409 % translates the argument of a call to the built-in predicate threaded/1 7410 7410 7411 '$lgt_tr_threaded_call'((TGoal; TGoals), ThreadedCall) :-7411 '$lgt_tr_threaded_call'((TGoal; TGoals), catch(ThreadedCall, '$lgt_terminated', fail)) :- 7412 7412 !, 7413 7413 '$lgt_tr_threaded_or_call'((TGoal; TGoals), Queue, MTGoals, Ids, Results), … … 7418 7418 ). 7419 7419 7420 '$lgt_tr_threaded_call'((TGoal, TGoals), ThreadedCall) :-7420 '$lgt_tr_threaded_call'((TGoal, TGoals), catch(ThreadedCall, '$lgt_terminated', fail)) :- 7421 7421 !, 7422 7422 '$lgt_tr_threaded_and_call'((TGoal, TGoals), Queue, MTGoals, Ids, Results), … … 13204 13204 13205 13205 '$lgt_mt_threaded_and_exit'(terminate, _, Ids, _) :- 13206 '$lgt_mt_threaded_call_cancel'(Ids). 13207 13208 '$lgt_mt_threaded_and_exit'(exception(Error), _, Ids, _) :- 13209 '$lgt_mt_threaded_call_cancel'(Ids, Error), 13210 throw(Error). 13206 '$lgt_mt_threaded_call_cancel'(Ids), 13207 throw('$lgt_terminated'). 13208 13209 '$lgt_mt_threaded_and_exit'(exception(Error), Id, Ids, Results) :- 13210 ( Error == '$lgt_terminated' -> 13211 '$lgt_mt_threaded_and_exit'(Ids, Results) 13212 ; '$lgt_mt_threaded_call_cancel'(Ids, Id), 13213 throw(Error) 13214 ). 13211 13215 13212 13216 '$lgt_mt_threaded_and_exit'(true, Id, Ids, Results) :- … … 13218 13222 ). 13219 13223 13220 '$lgt_mt_threaded_and_exit'(false, _, Ids, _) :-13221 '$lgt_mt_threaded_call_cancel'(Ids ),13224 '$lgt_mt_threaded_and_exit'(false, Id, Ids, _) :- 13225 '$lgt_mt_threaded_call_cancel'(Ids, Id), 13222 13226 fail. 13223 13227 … … 13266 13270 13267 13271 '$lgt_mt_threaded_or_exit'(terminate, _, Ids, _) :- 13268 '$lgt_mt_threaded_call_cancel'(Ids). 13269 13270 '$lgt_mt_threaded_or_exit'(exception(Error), _, Ids, _) :- 13271 '$lgt_mt_threaded_call_cancel'(Ids, Error), 13272 throw(Error). 13272 '$lgt_mt_threaded_call_cancel'(Ids), 13273 throw('$lgt_terminated'). 13274 13275 '$lgt_mt_threaded_or_exit'(exception(Error), Id, Ids, Results) :- 13276 ( Error == '$lgt_terminated' -> 13277 '$lgt_mt_threaded_or_exit'(Ids, Results) 13278 ; '$lgt_mt_threaded_call_cancel'(Ids, Id), 13279 throw(Error) 13280 ). 13273 13281 13274 13282 '$lgt_mt_threaded_or_exit'(true, Id, Ids, Results) :- 13275 13283 thread_get_message('$lgt_result'(Id, TGoal)), 13276 '$lgt_mt_threaded_call_cancel'(Ids ),13284 '$lgt_mt_threaded_call_cancel'(Ids, Id), 13277 13285 '$lgt_mt_threaded_or_exit_unify'(Results, Id, TGoal). 13278 13286 … … 13329 13337 13330 13338 13331 % '$lgt_mt_threaded_call_ abort'(+list(thread_identifier))13339 % '$lgt_mt_threaded_call_cancel'(+list(thread_identifier), thread_identifier) 13332 13340 % 13333 13341 % aborts a threaded call by aborting and joining all individual threads; 13334 13342 % we must use catch/3 as some threads may already be terminated 13343 13344 '$lgt_mt_threaded_call_cancel'(Ids, ProtectedId) :- 13345 '$lgt_mt_threaded_call_abort'(Ids, ProtectedId), 13346 '$lgt_mt_threaded_call_join'(Ids). 13347 13348 13349 '$lgt_mt_threaded_call_abort'([], _). 13350 13351 '$lgt_mt_threaded_call_abort'([ProtectedId| Ids], ProtectedId) :- 13352 !, 13353 '$lgt_mt_threaded_call_abort'(Ids, ProtectedId). 13354 13355 '$lgt_mt_threaded_call_abort'([Id| Ids], ProtectedId) :- 13356 ( catch(thread_peek_message(Id, '$lgt_master'), _, fail) -> 13357 catch(thread_send_message(Id, '$lgt_status'(_, terminate)), _, true) 13358 ; catch(thread_signal(Id, '$lgt_mt_thread_abort'), _, true) 13359 ), 13360 '$lgt_mt_threaded_call_abort'(Ids, ProtectedId). 13361 13335 13362 13336 13363 '$lgt_mt_threaded_call_cancel'(Ids) :- … … 13344 13371 ( catch(thread_peek_message(Id, '$lgt_master'), _, fail) -> 13345 13372 catch(thread_send_message(Id, '$lgt_status'(_, terminate)), _, true) 13346 ; catch(thread_signal(Id, '$lgt_mt_thread_abort' (abort)), _, true)13373 ; catch(thread_signal(Id, '$lgt_mt_thread_abort'), _, true) 13347 13374 ), 13348 13375 '$lgt_mt_threaded_call_abort'(Ids). 13349 13350 13351 '$lgt_mt_threaded_call_cancel'(Ids, Error) :-13352 '$lgt_mt_threaded_call_abort'(Ids, Error),13353 '$lgt_mt_threaded_call_join'(Ids).13354 13355 13356 '$lgt_mt_threaded_call_abort'([], _).13357 13358 '$lgt_mt_threaded_call_abort'([Id| Ids], Error) :-13359 ( catch(thread_peek_message(Id, '$lgt_master'), _, fail) ->13360 catch(thread_send_message(Id, '$lgt_status'(_, terminate)), _, true)13361 ; catch(thread_signal(Id, '$lgt_mt_thread_abort'(Error)), _, true)13362 ),13363 '$lgt_mt_threaded_call_abort'(Ids, Error).13364 13376 13365 13377 … … 13371 13383 13372 13384 13373 '$lgt_mt_thread_abort' (Error):-13385 '$lgt_mt_thread_abort' :- 13374 13386 mutex_unlock_all, 13375 throw( Error).13387 throw('$lgt_terminated'). 13376 13388 13377 13389 -
trunk/RELEASE_NOTES.txt
r4303 r4305 22 22 Updated the Logtalk runtime error handler to test for non-instantiated 23 23 exception terms. Thanks to Joerg Schuster for the bug report. 24 25 Corrected a bug in the implementation of the built-in meta-predicate 26 threaded/1 when canceling individual threads when one of them terminates 27 with an exception or a failure. 24 28 25 29 Added a new default compiler option, multifile_directive, to all config
