task* execute() {
    __exec_begin__(getTaskId());

    // READ
    CaptureLockAcquire(get_cur_tid(), (ADDRINT)&x_mutex);
    myLock.acquire(x_mutex);

    int class_var = x;

    CaptureLockRelease(get_cur_tid());
    myLock.release();

    class_var++;

    // WRITE
    CaptureLockAcquire(get_cur_tid(), (ADDRINT)&x_mutex);
    myLock.acquire(x_mutex);

    x = class_var;

    CaptureLockRelease(get_cur_tid());
    myLock.release();


    __exec_end__(getTaskId());
    return NULL;
  }
예제 #2
0
  task* execute() {
    __exec_begin__(getTaskId());
    RecordTExecute(get_cur_tid());

    RecordTLockAcq(get_cur_tid(), &x_mutex);
    CaptureLockAcquire(get_cur_tid(), (ADDRINT)&x_mutex);
    myLock.acquire(x_mutex);

    int str_1 = 1;
    RecordTStore (get_cur_tid(), &c, &str_1);
    c = true;

    // READ & WRITE
    RecordTLoad (get_cur_tid(), &shd_var);
    int tmp = shd_var + 1;
    RecordTStore (get_cur_tid(), &shd_var, &tmp);
    shd_var++;

    RecordTLockRel(get_cur_tid(), &x_mutex);
    CaptureLockRelease(get_cur_tid(), (ADDRINT)&x_mutex);
    myLock.release();

    RecordTReturn(get_cur_tid());
    __exec_end__(getTaskId());
    return NULL;
  }
예제 #3
0
  task* execute() {

    __exec_begin__(getTaskId());
    RecordTExecute(get_cur_tid());

    RecordTLockAcq(get_cur_tid(), &x_mutex);
    CaptureLockAcquire(get_cur_tid(), (ADDRINT)&x_mutex);
    myLock.acquire(x_mutex);

    RecordTLoad (get_cur_tid(), &c);
    if (c == false) {
      int str_2 = 0;
      RecordTBrCheck(get_cur_tid(), &c, &str_2, EQ);

      // READ & WRITE
      RecordTLoad (get_cur_tid(), &shd[getTaskId()]);
      int tmp = shd[getTaskId()] + 1;
      RecordTStore (get_cur_tid(), &shd[getTaskId()], &tmp);
      shd[getTaskId()]++;

      RecordTLockRel(get_cur_tid(), &x_mutex);
      CaptureLockRelease(get_cur_tid(), (ADDRINT)&x_mutex);
      myLock.release();
    } else {
      int str_2 = 0;
      RecordTBrCheck(get_cur_tid(), &c, &str_2, NEQ);

      RecordTLockRel(get_cur_tid(), &x_mutex);
      CaptureLockRelease(get_cur_tid(), (ADDRINT)&x_mutex);
      myLock.release();
      
      // READ & WRITE
      RecordTLoad (get_cur_tid(), &shd_var);
      int tmp = shd_var + 1;
      RecordTStore (get_cur_tid(), &shd_var, &tmp);
      shd_var++;

    }

    RecordTReturn(get_cur_tid());
    __exec_end__(getTaskId());
    return NULL;
  }
  task* execute() {
    __exec_begin__(getTaskId());

    // WRITE
    CaptureLockAcquire(get_cur_tid(), (ADDRINT)&x_mutex);
    myLock.acquire(x_mutex);
    x = 5325;
    CaptureLockRelease(get_cur_tid());
    myLock.release();

    __exec_end__(getTaskId());
    return NULL;
  }