Added new flag "max_workers". It uses a C function, "p_max_workers" that is currently defined in the *wrong* place ("threads.c").
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2193 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
1c7681b179
commit
48e8101a87
@ -645,6 +645,12 @@ p_nof_threads(void)
|
||||
return Yap_unify(ARG1,MkIntegerTerm(i));
|
||||
}
|
||||
|
||||
static Int
|
||||
p_max_workers(void)
|
||||
{ /* '$max_workers'(+P) */
|
||||
return Yap_unify(ARG1,MkIntegerTerm(MAX_WORKERS));
|
||||
}
|
||||
|
||||
static Int
|
||||
p_max_threads(void)
|
||||
{ /* '$max_threads'(+P) */
|
||||
@ -666,6 +672,7 @@ p_thread_runtime(void)
|
||||
void Yap_InitThreadPreds(void)
|
||||
{
|
||||
Yap_InitCPred("$no_threads", 0, p_no_threads, HiddenPredFlag);
|
||||
Yap_InitCPred("$max_workers", 1, p_max_workers, HiddenPredFlag);
|
||||
Yap_InitCPred("$max_threads", 1, p_max_threads, HiddenPredFlag);
|
||||
Yap_InitCPred("$thread_new_tid", 1, p_thread_new_tid, HiddenPredFlag);
|
||||
Yap_InitCPred("$create_thread", 6, p_create_thread, HiddenPredFlag);
|
||||
|
@ -537,7 +537,8 @@ or-parallelism supported by one of these three forms. This option is
|
||||
still highly experimental.
|
||||
|
||||
@item @code{--with-max-workers} allows definition of the maximum
|
||||
number of parallel processes.
|
||||
number of parallel processes (its value can be consulted at runtime
|
||||
using the flag @code{max_workers}).
|
||||
|
||||
@item @code{--with-gmp[=DIR]} give a path to where one can find the
|
||||
@code{GMP} library if not installed in the default path.
|
||||
@ -7775,6 +7776,11 @@ integers that are writable character codes using the list notation. It
|
||||
is @code{on} if enables or @code{off} if disabled. The default value for
|
||||
this flag is @code{off}.
|
||||
|
||||
@item max_workers
|
||||
@findex max_workers (yap_flag/2 option)
|
||||
@* Read-only flag telling the maximum number of Prolog workers when using
|
||||
or-parallelism.
|
||||
|
||||
@item max_threads
|
||||
@findex max_threads (yap_flag/2 option)
|
||||
@* Read-only flag telling the maximum number of Prolog threads that can
|
||||
|
@ -817,6 +817,15 @@ yap_flag(float_format,X) :-
|
||||
yap_flag(float_format,X) :-
|
||||
'$do_error'(type_error(atom,X),yap_flag(float_format,X)).
|
||||
|
||||
yap_flag(max_workers,X) :-
|
||||
var(X), !,
|
||||
'$max_workers'(X).
|
||||
yap_flag(max_workers,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,max_workers),yap_flag(max_workers,X)).
|
||||
yap_flag(max_workers,X) :-
|
||||
'$do_error'(domain_error(flag_value,max_workers+X),yap_flag(max_workers,X)).
|
||||
|
||||
yap_flag(max_threads,X) :-
|
||||
var(X), !,
|
||||
'$max_threads'(X).
|
||||
@ -865,6 +874,7 @@ yap_flag(dialect,yap).
|
||||
V = max_arity ;
|
||||
V = max_integer ;
|
||||
V = max_tagged_integer ;
|
||||
V = max_workers ;
|
||||
V = max_threads ;
|
||||
V = min_integer ;
|
||||
V = min_tagged_integer ;
|
||||
|
Reference in New Issue
Block a user