Closed torbjornlager closed 8 years ago
Which version are you running? Works just fine here (7,.3.15, but this hasn't changed in a while)
1 ?- use_module(library(pengines)).
true.
2 ?- pengine_create([id(Pid)]).
Pid = '96091231-e33c-4dec-b5d1-66099ef11887'.
Hmm, seems to work for me too now. But I think I know what fooled me into thinking it didn't work at all. It appears that if I create three pengines in a row, the behaviour is less than helpful if I try to create a forth one, when the slave-limit kicks in. See below. So not really a bug, but a behaviour that could perhaps be made more helpful.
?- pengine_create([id(Pid)]). Pid = '4d079347-1d40-480e-b10e-826561861c39'.
?- pengine_create([id(Pid)]). Pid = '8be95daa-95a6-4e9c-99f1-a55ab1d4d411'.
?- pengine_create([id(Pid)]). Pid = 'fbb7aa9e-56a2-4c89-af4f-f797ee1c655a'.
?- pengine_create([id(Pid)]). true. <== NOT HELPFUL
?- thread_get_message(M). M = pengine_event('4d079347-1d40-480e-b10e-826561861c39', create('4d079347-1d40-480e-b10e-826561861c39', [slave_limit(3)])).
?- thread_get_message(M). M = pengine_event('8be95daa-95a6-4e9c-99f1-a55ab1d4d411', create('8be95daa-95a6-4e9c-99f1-a55ab1d4d411', [slave_limit(3)])).
?- thread_get_message(M). M = pengine_event('fbb7aa9e-56a2-4c89-af4f-f797ee1c655a', create('fbb7aa9e-56a2-4c89-af4f-f797ee1c655a', [slave_limit(3)])).
?- thread_get_message(M). M = pengine_event('d6105145-3b52-4b4d-b182-1d2977cbec98', error('d6105145-3b52-4b4d-b182-1d2977cbec98', error(resource_error(max_pengines), _G1476))).
Changed to make pengine_create/1 return the create error as an exception. I think that makes more sense. Strictly not really a bug though. I can even imagine we can think of scenarios where the old behaviour is desired. Well, we can add an option for that case.
This used to work, but no longer does:
?- use_module(library(pengines). true. ?- pengine_create([id(Pid)]). ERROR: thread_create/3: Uninstantiated argument expected, found [id(_G1151)](2-nd argument)