From 58c99d52bab5e5ca12707893498627d143e40e8b Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Wed, 4 Oct 2006 04:29:57 +0000 Subject: [PATCH] cleaned comments, output --- test/lladd/check_lockManager.c | 60 ++++++++++++---------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/test/lladd/check_lockManager.c b/test/lladd/check_lockManager.c index cd5ef10..961316c 100644 --- a/test/lladd/check_lockManager.c +++ b/test/lladd/check_lockManager.c @@ -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(); + if(LLADD_DEADLOCK == globalLockManager.readLockPage(xid, m)) { + k = 0; + assert(compensation_error() == LLADD_DEADLOCK); + compensation_clear_error(); + globalLockManager.abort(xid); + deadlocks++; + locked = 1; + } } 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); + if(LLADD_DEADLOCK == globalLockManager.readLockRecord(xid, rid)) { + k = 0; + globalLockManager.abort(xid); + deadlocks++; + } } 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); + if(LLADD_DEADLOCK == globalLockManager.writeLockRecord(xid, rid)) { + k = 0; + globalLockManager.abort(xid); + deadlocks++; + } } } @@ -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;