Example #1
0
// code for the asynchronous server loop
// we must create and attach a new Prolog engine to enable
// calls to Prolog from this thread.
static void prolog_thread_func(void *data)
{
	my_server_thread st = (my_server_thread)data;

	printf("OSC server started.\n");
	PL_thread_attach_engine(NULL);
	my_server_thread_run(st,10);
	PL_thread_destroy_engine(); 
	printf("OSC server stopped.\n");
	pthread_exit(NULL);
}
void release_prolog(pTHX_ pMY_CXT) {
    if (c_prolog_ok && c_prolog_init) {
#ifdef MULTIPLICITY
	/* warn ("destroying Prolog engine"); */
	PL_thread_destroy_engine();
#else
	warn ("Prolog cleanup");
	PL_cleanup(0);
#endif
	c_prolog_init=0;
	c_prolog_ok=0;
    }
}