Prolog Text thread

/**
 * Prolog code for the sampling thread.
 *
 * Copyright 2012, XLOG Technologies GmbH, Switzerland
 * Jekejeke Prolog 0.9.3 (a fast and small prolog interpreter)
 */

:- current_prolog_flag(source_file,X), set_source_property(X,sys_notrace).

:- foreign(start_sampler/1, 'jekdev.study.ports.ThreadAPI', startSampler('Interpreter')).
:- foreign(stop_sampler/1, 'jekdev.study.ports.ThreadAPI', stopSampler('Term')).

:- thread_local handle/1.

start_sampler :-
  start_sampler(X),
  assertz(handle(X)).

stop_sampler :-
  retract(handle(X)),
  stop_sampler(X).

Kommentare