On Monday 23 April 2012 07:50:41 you wrote: > In this test, the main thread is stuck waiting in the pause() command in > Parrot_cx_outer_runloop(PARROT_INTERP). alarm_count = 1.
Ah, could be the same thing that hit me this weekend. There's a comment in parrotinterpreter.pmc predicting exactly this situation but for some unknown reason it never hit me till now. As so often with threads it may just me a timing problem. Could you try the attached patch if it fixes the test for you? > Each of the 4 worker threads is stuck in an infinte loop here in > threads.c: > > Here's the function. The call to VTABLE_get_integer(interp, scheduler) > always returns 0. The next statement, > alarm_count = VTABLE_get_integer(interp, sched->alarms); > also returns 0, and the process repeats indefinitely. I should just leave out the if (alarm_count > 0). If a child thread has no active tasks, it should simply wait for new ones. But as it is, it's harmless except for uselessly burning CPU. > I didn't have time to investigate all the other failures; I figure I > should start with the simplest one first. If there's a simpler test > to look at, I could do so, but since this is my first foray into > debugging threads on Solaris, and since it's also my first foray into > threads on Parrot, it takes a long time to make any progress. Was the same for me :) But let's fix the simple ones, maybe the others will disappear as well. Stefan
diff --git a/src/pmc/parrotinterpreter.pmc b/src/pmc/parrotinterpreter.pmc
index be1efe9..9243c05 100644
--- a/src/pmc/parrotinterpreter.pmc
+++ b/src/pmc/parrotinterpreter.pmc
@@ -32,6 +32,8 @@ These are the vtable functions for the ParrotInterpreter base class
#include "pmc/pmc_sub.h"
#include "pmc/pmc_proxy.h"
#include "pmc/pmc_task.h"
+#include "signal.h"
+#include "unistd.h"
#define PMC_interp(x) ((Parrot_ParrotInterpreter_attributes *)PMC_data(x))->interp
#define PMC_args(x) ((Parrot_ParrotInterpreter_attributes *)PMC_data(x))->args
@@ -816,6 +818,11 @@ Schedules the given task on the proxy's interpreter.
Parrot_unblock_GC_mark_locked(proxied_interp);
/*TODO: investigate why it's not neccessary to send a signal to the process here
in theory the main thread could be pause()ing but in practice it seems to work anyway */
+#ifdef _WIN32
+ /* TODO: Implement on Windows */
+#else
+ kill(getpid(), 14);
+#endif
}
}
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
