Show
Ignore:
Timestamp:
03/04/08 16:19:45 (10 months ago)
Author:
pmoura
Message:

Corrected a Logtalk compiler bug that allowed a predicate to be declared both dynamic and synchronized. Improved error checking when compiling dynamic predicate directives. Improved documentation of some internal multi-threading support predicates.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4122 r4125  
    55375537    '$lgt_valid_pred_ind'(Pred, Functor, Arity), 
    55385538    !, 
    5539     functor(Head, Functor, Arity), 
    5540     (   '$lgt_pp_calls_pred_'(Functor, Arity, _, _) -> 
     5539    (   '$lgt_pp_dynamic_'(Functor, Arity) -> 
    55415540        throw(permission_error(modify, predicate_interpretation, Pred)) 
    5542     ;   assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
     5541    ;   '$lgt_pp_calls_pred_'(Functor, Arity, _, _) -> 
     5542        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5543    ;   functor(Head, Functor, Arity), 
     5544        assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
    55435545        '$lgt_tr_synchronized_directive'(Preds, Mutex) 
    55445546    ). 
     
    55475549    '$lgt_valid_gr_ind'(Pred, Functor, Arity, Arity2), 
    55485550    !, 
    5549     functor(Head, Functor, Arity2), 
    5550     (   '$lgt_pp_calls_nt_'(Functor, Arity) -> 
     5551    (   '$lgt_pp_dynamic_'(Functor, Arity2) -> 
     5552        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5553    ;   '$lgt_pp_calls_nt_'(Functor, Arity) -> 
    55515554        throw(permission_error(modify, non_terminal_interpretation, Pred)) 
    5552     ;   assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
     5555    ;   functor(Head, Functor, Arity2), 
     5556        assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
    55535557        '$lgt_tr_synchronized_directive'(Preds, Mutex) 
    55545558    ). 
     
    56675671    throw(instantiation_error). 
    56685672 
    5669 '$lgt_tr_dynamic_directive'([Pred| _]) :- 
    5670     functor(Pred, Functor, Arity), 
    5671     '$lgt_pp_calls_pred_'(Functor, Arity, _, _), 
    5672     throw(permission_error(modify, predicate_interpretation, Pred)). 
    5673  
    56745673'$lgt_tr_dynamic_directive'([Pred| Preds]) :- 
    56755674    '$lgt_valid_pred_ind'(Pred, Functor, Arity), 
    56765675    !, 
    5677     assertz('$lgt_pp_dynamic_'(Functor, Arity)), 
    5678     '$lgt_tr_dynamic_directive'(Preds). 
     5676    (   functor(Head, Functor, Arity), 
     5677        '$lgt_pp_synchronized_'(Head, _) -> 
     5678        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5679    ;   '$lgt_pp_calls_pred_'(Functor, Arity, _, _) -> 
     5680        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5681    ;   assertz('$lgt_pp_dynamic_'(Functor, Arity)), 
     5682        '$lgt_tr_dynamic_directive'(Preds) 
     5683    ). 
    56795684 
    56805685'$lgt_tr_dynamic_directive'([Pred| Preds]) :- 
    5681     '$lgt_valid_gr_ind'(Pred, Functor, _, Arity2), 
    5682     !, 
    5683     assertz('$lgt_pp_dynamic_'(Functor, Arity2)), 
    5684     '$lgt_tr_dynamic_directive'(Preds). 
     5686    '$lgt_valid_gr_ind'(Pred, Functor, Arity, Arity2), 
     5687    !, 
     5688    (   functor(Head, Functor, Arity2), 
     5689        '$lgt_pp_synchronized_'(Head, _) -> 
     5690        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5691    ;   '$lgt_pp_calls_nt_'(Functor, Arity) -> 
     5692        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5693    ;   assertz('$lgt_pp_dynamic_'(Functor, Arity2)), 
     5694        '$lgt_tr_dynamic_directive'(Preds) 
     5695    ). 
    56855696 
    56865697'$lgt_tr_dynamic_directive'([Pred| _]) :- 
     
    1293412945 
    1293512946 
    12936 % '$lgt_mt_check_threads'(@list, @list) 
    12937 % 
    12938 % checks sucesseful creation of working "or" threads 
     12947% '$lgt_mt_check_threads'(@list, +message_queue_identifier) 
     12948% 
     12949% checks sucesseful creation of working threads; failure to create a thread 
     12950% usually results from exhaustion of virtual memory address space or exceeding  
     12951% the maximum number of threads allowed by the back-end Prolog compiler 
    1293912952 
    1294012953'$lgt_mt_check_threads'([], _). 
     
    1295112964% '$lgt_mt_threaded_and_exit'(+callable, +message_queue_identifier, +list) 
    1295212965% 
    12953 % retrieves the result of proving a conjunction of goals using a threaded/1 predicate call 
     12966% retrieves the result of proving a conjunction of goals using a threaded/1 predicate 
     12967% call by collecting the individual thread results posted to the call message queue 
    1295412968 
    1295512969'$lgt_mt_threaded_and_exit'(TGoals, Queue, Results) :- 
     
    1304613060% '$lgt_mt_threaded_or_exit'(+callable, +message_queue_identifier, +list) 
    1304713061% 
    13048 % retrieves the result of proving a disjunction of goals using a threaded/1 predicate call 
     13062% retrieves the result of proving a disjunction of goals using a threaded/1 predicate 
     13063% call by collecting the individual thread results posted to the call message queue 
    1304913064 
    1305013065'$lgt_mt_threaded_or_exit'(TGoals, Queue, Results) :-