cleaned comments, output
This commit is contained in:
parent
9169bfc075
commit
58c99d52ba
1 changed files with 20 additions and 40 deletions
|
@ -17,7 +17,6 @@
|
|||
|
||||
void * pageWorkerThread(void * j) {
|
||||
int xid = *(int*)j;
|
||||
//startTransaction(xid);
|
||||
globalLockManager.begin(xid);
|
||||
recordid rid;
|
||||
rid.page = 0;
|
||||
|
@ -31,38 +30,24 @@ void * pageWorkerThread(void * j) {
|
|||
if(rw) {
|
||||
// readlock
|
||||
int locked = 0;
|
||||
// try_ret(0) {
|
||||
if(LLADD_DEADLOCK == globalLockManager.readLockPage(xid, m)) {
|
||||
k = 0;
|
||||
assert(compensation_error() == LLADD_DEADLOCK);
|
||||
compensation_clear_error();
|
||||
globalLockManager.abort(xid);
|
||||
deadlocks++;
|
||||
printf("-");
|
||||
locked = 1;
|
||||
}
|
||||
// } end_ret();
|
||||
} else {
|
||||
// writelock
|
||||
// int locked = 0;
|
||||
// begin_action_ret(NULL, NULL, 0) {
|
||||
|
||||
if(LLADD_DEADLOCK == globalLockManager.writeLockPage(xid, m)) {
|
||||
k = 0;
|
||||
globalLockManager.abort(xid);
|
||||
deadlocks++;
|
||||
printf("-");
|
||||
int err = compensation_error();
|
||||
assert(err == LLADD_DEADLOCK);
|
||||
compensation_clear_error();
|
||||
}
|
||||
/* if(locked) {
|
||||
int err = compensation_error();
|
||||
assert(err == LLADD_DEADLOCK);
|
||||
compensation_clear_error();
|
||||
} */
|
||||
// } end_action_ret(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +61,6 @@ void * pageWorkerThread(void * j) {
|
|||
void * ridWorkerThread(void * j) {
|
||||
|
||||
int xid = *(int*)j;
|
||||
//startTransaction(xid);
|
||||
globalLockManager.begin(xid);
|
||||
recordid rid;
|
||||
rid.page = 0;
|
||||
|
@ -90,26 +74,20 @@ void * ridWorkerThread(void * j) {
|
|||
if(rw) {
|
||||
// readlock
|
||||
|
||||
// begin_action_ret(NULL, NULL, 0) {
|
||||
if(LLADD_DEADLOCK == globalLockManager.readLockRecord(xid, rid)) {
|
||||
k = 0;
|
||||
globalLockManager.abort(xid);
|
||||
deadlocks++;
|
||||
printf("-");
|
||||
}
|
||||
// } end_action_ret(0);
|
||||
|
||||
} else {
|
||||
// writelock
|
||||
|
||||
// begin_action_ret(NULL, NULL, 0) {
|
||||
if(LLADD_DEADLOCK == globalLockManager.writeLockRecord(xid, rid)) {
|
||||
k = 0;
|
||||
globalLockManager.abort(xid);
|
||||
deadlocks++;
|
||||
printf("-");
|
||||
}
|
||||
// } end_action_ret(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,6 +107,7 @@ START_TEST(recordidLockManagerTest) {
|
|||
|
||||
pthread_t workers[THREAD_COUNT];
|
||||
int i;
|
||||
printf("The following numbers are deadlock counts for each thread.\n");
|
||||
for(i = 0; i < THREAD_COUNT; i++) {
|
||||
int *j = malloc(sizeof(int));
|
||||
*j = i;
|
||||
|
@ -147,6 +126,7 @@ START_TEST(pageLockManagerTest) {
|
|||
|
||||
pthread_t workers[THREAD_COUNT];
|
||||
int i;
|
||||
printf("The following numbers are deadlock counts for each thread.\n");
|
||||
for(i = 0; i < THREAD_COUNT; i++) {
|
||||
int *j = malloc(sizeof(int));
|
||||
*j = i;
|
||||
|
|
Loading…
Reference in a new issue