Re: Multithreading -- numbervars and autoload

Alan Baljeu <[email protected]> Thu, 19 Jun 2014 15:05:48 -0700
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Everybody got bumped.  We moved to https://groups.google.com/forum/#!forum/swi-prolog.  You can access that through gmail as well.
 

Alan Baljeu


________________________________
 From: Arun Lakhotia <[email protected]>
To: swi-prolog <[email protected]> 
Sent: Wednesday, June 18, 2014 8:12:13 PM
Subject: [SWIPL] Multithreading -- numbervars and autoload
 

Hi Jan:

I got bumped from the swipl mailing list due to too many bounced mails. May
have been due to some mailer error. I have just subscribed with my gmail
address. This should be more reliable.

I am running into some issues that are most likely related to
multithreading.

My application is a webservice, developed using the http/json libraries. I
am not using an database operations -- no assert, retract, etc.

Issues:

1)  numbervars gives different ordering of printed symbol names when there
are multiple simultaneous accesses to the server, as compared when there is
only one client connection at any time.

The online document indicates that all library predicates are thread safe,
so I am assuming numbervars is also thread safe. However, to be on the safe
side I wrapped the call with a  "with_mutex(...)" call. Unless I have
goofed up in the use of with_mutex, I see that the numbering is still
messed.

So is numbervars inherently non-deterministic.

I should add I am comparing results from different runs with exactly the
same input.

2) Autoloading of library predicates doesn't seem to do well with threads.
I  use "format_to_chars/3" in a portray clause.  When the application is
run with multiple simultaneous clients, several of its threads would give
error that this predicate was not known. I never had any issue when I had a
single client connecting to the server at a time.

Thanks,

Arun
-------------- next part --------------
HTML attachment scrubbed and removed
_______________________________________________
SWI-Prolog mailing list
[email protected]
https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
-------------- next part --------------
HTML attachment scrubbed and removed