Changeset 4456 for trunk/compiler

Show
Ignore:
Timestamp:
08/30/08 07:05:02 (4 months ago)
Author:
pmoura
Message:

Corrected a bug in the implementation of the threaded_once/1-2 built-in multi-threading predicates (use of detached threads could make the methods fail despite the success of the thread goals).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4453 r4456  
    1322013220 
    1322113221'$lgt_mt_dispatch_goal'(once, Queue, Goal, This, Self, Tag) :- 
    13222     thread_create('$lgt_mt_det_goal'(Queue, Goal, This, Self, Tag), _, [detached(true)]), 
     13222    thread_create('$lgt_mt_det_goal'(Queue, Goal, This, Self, Tag), _, [detached(false)]), 
    1322313223    % wait until the thread created for proving the goal is ready before proceeding: 
    1322413224    thread_get_message(Queue, '$lgt_det_ready'(Goal, This, Self, Tag)). 
     
    1326513265        thread_get_message(Queue, '$lgt_thread_id'(Type, Goal, This, Self, Tag, Id)), 
    1326613266        (   Type == once -> 
    13267             '$lgt_mt_det_reply'(Queue, Goal, This, Self, Tag, Id)           % detached thread 
     13267            '$lgt_mt_det_reply'(Queue, Goal, This, Self, Tag, Id), 
     13268            thread_join(Id, _) 
    1326813269        ;   call_cleanup( 
    1326913270                '$lgt_mt_non_det_reply'(Queue, Goal, This, Self, Tag, Id),