Thank you too! Will entirely stop queue's before returning from stop!
On 3/29/2010 16:15, Henrik Grubbström (Lysator) @ Pike (-) developers forum wrote:
Coen Schalkwijk wrote:
Ok. Could you (or anyone else?) tell me more about this, so I can take this into account?
Picture this:
[...]
Not quite, the problem is more likely to be something like this, which Marcus Agehall also has mentioned:
roxen_module.pike:
object B; f() { references B; }
void start() { Thread.thread_create(f); }
When Roxen loads the module, it will in essence do something like:
modules += ({ (program)"roxen_module.pike"() }); modules->start();
When time comes to shutdown Roxen will do something like:
modules->stop(); map(modules, destruct); // Other stuff... exit(0);
The problem here is that the thread started in start() will continue to run although its object has been destructed.
The fix is to implement a stop() in the module that makes sure that all threads belonging to the module have terminated before returning.
From the backtraces that you get, you should be able to identify from where the problematic thread originated.
This has little to do with the garbage collector, but more with when what variables are destroyed (explicitly) in stop() functions of e.g. class A.
True.
Stephen.