Commit c1460b46 authored by Vít Kabele's avatar Vít Kabele

Race condition in shvm-agent fixed. DispatchMP and SendSpecial test enabled again

parent 20f70c5c
......@@ -16,14 +16,14 @@
static jclass THREAD_CLASS = NULL;
static jclass STRING_CLASS = NULL;
static volatile int stop_tagger_thread = 0;
static int jvm_started = 0;
static jrawMonitorID tagging_lock;
static pthread_t tagger;
process_buffs signalize_end = { NULL, NULL, 0};
// ******************* Object tagging thread *******************
// TODO add cache - ??
......@@ -227,11 +227,14 @@ tagger_loop (void * arg) {
buffer_init (new_obj_buff, BUFFER_INITIAL_CAPACITY);
// exit when the jvm is terminated and there are no msg to process
while (!stop_tagger_thread || bq_length (&objtag_q) != 0) {
while (true) {
// get buffer - before tagging lock
process_buffs * pb;
bq_pop (&objtag_q, &pb);
// If the buffer acquired signalize the end -> Finish the thread
if (pb == &signalize_end) break;
// tag the objects - with lock
enter_critical_section (args->jvmti, tagging_lock);
{
......@@ -300,12 +303,11 @@ tagger_stop () {
ldebug ("stopping tagger thread\n");
//
// Signal the tagger thread to stop working. Because the thread may be
// waiting to receive a buffer from the tagging queue, send an empty
// buffer to the thread to make sure it wakes up.
// Signal the tagger thread to stop working.
// Use the method of mark at the end of queue. As the tagger will
// see this addres. Breaks the loop and exit.
//
stop_tagger_thread = 1;
process_buffs * empty = pb_normal_get (0);
process_buffs * empty = &signalize_end; //pb_normal_get (0);
tagger_enqueue (empty);
ldebug ("waiting for tagger thread to stop \n");
......
package ch.usi.dag.disl.test.suite.dispatchmp.junit;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
......@@ -8,7 +7,6 @@ import ch.usi.dag.disl.test.suite.ShadowVmTest;
@RunWith (JUnit4.class)
@Ignore
public class DispatchMPTest extends ShadowVmTest {
}
package ch.usi.dag.disl.test.suite.sendspecial.junit;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
......@@ -8,6 +7,5 @@ import ch.usi.dag.disl.test.suite.ShadowVmOnlyTest;
@RunWith (JUnit4.class)
@Ignore
public class SendSpecialTest extends ShadowVmOnlyTest {
}
......@@ -18,7 +18,7 @@ import ch.usi.dag.util.Strings;
public abstract class Runner {
protected static final Duration _INIT_TIME_LIMIT_ = Duration.of (3, SECONDS);
protected static final Duration _TEST_TIME_LIMIT_ = Duration.of (10, SECONDS);
protected static final Duration _TEST_TIME_LIMIT_ = Duration.of (15, SECONDS);
protected static final Duration _WATCH_DELAY_ = Duration.of (100, MILLISECONDS);
protected static final String _ENV_JAVA_HOME_ = "JAVA_HOME";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment