Module group

A Prolog thread group is simply a Java thread group. A Prolog thread group might contain Prolog threads and otherwise threads. The predicate group_new/1 creates a new thread group. The predicate group_thread/2 allows retrieving the oldest member. The predicate current_group_flag /3 allows inspecting thread group properties.

Example:
?- threads.
Thread State Group
Thread-2 WAITING main
Thread-3 RUNNABLE Group-1
Thread-4 WAITING Group-1
Yes

The predicate current_thread/1 succeeds for the Prolog threads currently known to the base knowledge base. The predicate threads/0 lists the same threads on the standard output. The Prolog threads are shown with their state and their group. Currently the predicates also list threads across different sub knowledge bases.

The following group predicates are provided:

group_new(G):
The predicate succeeds for a new thread group G.
thread_new(G, C, T):
The predicate succeeds for a new thread T on the copy of the goal C inside the thread group G.
group_thread(G, T):
The predicate succeeds in T with the oldest thread of the thread group G if there is any. Otherwise the predicate fails.
current_thread(G, T):
The predicate succeeds in T with the threads of the thread group G.
current_group(G, H):
The predicate succeeds in H with the groups of the thread group G.
current_group_flag(G, K, V):
The predicate succeeds for the values V of the keys K concerning the group G. The following keys are returned by the predicate.

sys_group_name: The name of the group.
sys_group_group: The group of the group.
sys_group_store: The store of the group.

current_thread(T):
The predicate succeeds in T with the managed threads.
threads:
The predicate lists the managed threads.



Kommentare