1
0
Fork 0

changed return value of locks, spelling

This commit is contained in:
Frank Celler 2011-12-22 15:39:19 +01:00
parent be39e1f6ed
commit aa1b29163f
4 changed files with 9 additions and 27 deletions

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_IMPL_H #ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_IMPL_H
#define TRIAGENS_FYN_DISPATCHER_DISPATCHER_IMPL_H 1 #define TRIAGENS_FYN_DISPATCHER_DISPATCHER_IMPL_H 1
#include <BasicsC/Common.h> #include <Basics/Common.h>
#include <Rest/Dispatcher.h> #include <Rest/Dispatcher.h>
#include <Basics/Mutex.h> #include <Basics/Mutex.h>

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_QUEUE_H #ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_QUEUE_H
#define TRIAGENS_FYN_DISPATCHER_DISPATCHER_QUEUE_H 1 #define TRIAGENS_FYN_DISPATCHER_DISPATCHER_QUEUE_H 1
#include <BasicsC/Common.h> #include <Basics/Common.h>
#include <Basics/ConditionVariable.h> #include <Basics/ConditionVariable.h>
#include <Rest/Dispatcher.h> #include <Rest/Dispatcher.h>

View File

@ -69,10 +69,7 @@ namespace triagens {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void DispatcherThread::run () { void DispatcherThread::run () {
if (! queue->accessQueue.lock()) { queue->accessQueue.lock();
LOGGER_FATAL << "cannot lock in " << __FILE__ << "@" << __LINE__;
exit(EXIT_FAILURE);
}
queue->nrStarted--; queue->nrStarted--;
queue->nrRunning++; queue->nrRunning++;
@ -115,10 +112,7 @@ namespace triagens {
} }
// now release the queue lock (initialise is inside the lock, work outside) // now release the queue lock (initialise is inside the lock, work outside)
if (! queue->accessQueue.unlock()) { queue->accessQueue.unlock();
LOGGER_FATAL << "cannot unlock in " << __FILE__ << "@" << __LINE__;
exit(EXIT_FAILURE);
}
// do the work (this might change the job type) // do the work (this might change the job type)
Job::status_e status = Job::JOB_FAILED; Job::status_e status = Job::JOB_FAILED;
@ -191,10 +185,7 @@ namespace triagens {
status = Job::JOB_FAILED; status = Job::JOB_FAILED;
} }
if (! queue->accessQueue.lock()) { queue->accessQueue.lock();
LOGGER_FATAL << "cannot lock in " << __FILE__ << "@" << __LINE__;
exit(EXIT_FAILURE);
}
queue->monopolizer = 0; queue->monopolizer = 0;
@ -224,10 +215,7 @@ namespace triagens {
} }
if (0 < queue->nrWaiting && ! queue->readyJobs.empty()) { if (0 < queue->nrWaiting && ! queue->readyJobs.empty()) {
if (! queue->accessQueue.broadcast()) { queue->accessQueue.broadcast();
LOGGER_FATAL << "cannot broadcast in " << __FILE__ << "@" << __LINE__;
exit(EXIT_FAILURE);
}
} }
tick(); tick();
@ -238,10 +226,7 @@ namespace triagens {
tick(); tick();
if (! queue->accessQueue.wait()) { queue->accessQueue.wait();
LOGGER_FATAL << "cannot wait in " << __FILE__ << "@" << __LINE__;
exit(EXIT_FAILURE);
}
tick(); tick();
@ -260,10 +245,7 @@ namespace triagens {
queue->nrSpecial--; queue->nrSpecial--;
} }
if (! queue->accessQueue.unlock()) { queue->accessQueue.unlock();
LOGGER_FATAL << "cannot unlock in " << __FILE__ << "@" << __LINE__;
exit(EXIT_FAILURE);
}
LOGGER_TRACE << "dispatcher thread has finished"; LOGGER_TRACE << "dispatcher thread has finished";
} }

View File

@ -29,7 +29,7 @@
#ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_THREAD_H #ifndef TRIAGENS_FYN_DISPATCHER_DISPATCHER_THREAD_H
#define TRIAGENS_FYN_DISPATCHER_DISPATCHER_THREAD_H 1 #define TRIAGENS_FYN_DISPATCHER_DISPATCHER_THREAD_H 1
#include <BasicsC/Common.h> #include <Basics/Common.h>
#include <Basics/Thread.h> #include <Basics/Thread.h>
#include <Rest/Job.h> #include <Rest/Job.h>