summaryrefslogtreecommitdiffstats
path: root/src/uscxml/concurrency
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-10-16 18:35:17 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-10-16 18:35:17 (GMT)
commit60c543c1d8c6699cc96829f15b16ecc60ac0b410 (patch)
treef0087f620d45246acf0268da539cb815796d88c0 /src/uscxml/concurrency
parent4d186e24e44fe07f04708c2dc38387534c02c7fd (diff)
downloaduscxml-60c543c1d8c6699cc96829f15b16ecc60ac0b410.zip
uscxml-60c543c1d8c6699cc96829f15b16ecc60ac0b410.tar.gz
uscxml-60c543c1d8c6699cc96829f15b16ecc60ac0b410.tar.bz2
Added license information and bug fixes
Diffstat (limited to 'src/uscxml/concurrency')
-rw-r--r--src/uscxml/concurrency/BlockingQueue.h20
-rw-r--r--src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp25
-rw-r--r--src/uscxml/concurrency/eventqueue/DelayedEventQueue.h29
-rw-r--r--src/uscxml/concurrency/tinythread.h25
4 files changed, 82 insertions, 17 deletions
diff --git a/src/uscxml/concurrency/BlockingQueue.h b/src/uscxml/concurrency/BlockingQueue.h
index 0826590..a77bfb7 100644
--- a/src/uscxml/concurrency/BlockingQueue.h
+++ b/src/uscxml/concurrency/BlockingQueue.h
@@ -1,6 +1,26 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
#ifndef BLOCKINGQUEUE_H_4LEVMY0N
#define BLOCKINGQUEUE_H_4LEVMY0N
+#include "uscxml/Common.h"
#include "uscxml/concurrency/tinythread.h"
#include <list>
diff --git a/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp b/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp
index 28bd343..b29c9ca 100644
--- a/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp
+++ b/src/uscxml/concurrency/eventqueue/DelayedEventQueue.cpp
@@ -1,3 +1,22 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
#include "uscxml/Message.h"
#include "DelayedEventQueue.h"
#include <glog/logging.h>
@@ -31,8 +50,12 @@ void DelayedEventQueue::run(void* instance) {
DelayedEventQueue* INSTANCE = (DelayedEventQueue*)instance;
int result;
while(INSTANCE->_isStarted) {
+#ifndef EVLOOP_NO_EXIT_ON_EMPTY
+ result = event_base_dispatch(INSTANCE->_eventLoop);
+#else
//result = event_base_dispatch(THIS->_eventLoop);
result = event_base_loop(INSTANCE->_eventLoop, EVLOOP_NO_EXIT_ON_EMPTY);
+#endif
(void)result;
}
}
@@ -53,7 +76,7 @@ void DelayedEventQueue::addEvent(std::string eventId, int fd, short opMask, void
_callbackData[eventId].callback = callback;
_callbackData[eventId].event = event;
_callbackData[eventId].persist = false;
-
+
event_add(event, NULL);
}
diff --git a/src/uscxml/concurrency/eventqueue/DelayedEventQueue.h b/src/uscxml/concurrency/eventqueue/DelayedEventQueue.h
index fa76c3f..90ff819 100644
--- a/src/uscxml/concurrency/eventqueue/DelayedEventQueue.h
+++ b/src/uscxml/concurrency/eventqueue/DelayedEventQueue.h
@@ -1,3 +1,22 @@
+/**
+ * @file
+ * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
#ifndef DELAYEDEVENTQUEUE_H_JA6WRBVP
#define DELAYEDEVENTQUEUE_H_JA6WRBVP
@@ -15,15 +34,15 @@
namespace uscxml {
-class DelayedEventQueue {
+class USCXML_API DelayedEventQueue {
public:
enum OpMask {
- DEQ_READ = EV_READ,
- DEQ_WRITE = EV_WRITE,
- DEQ_SIGNAL = EV_SIGNAL
+ DEQ_READ = EV_READ,
+ DEQ_WRITE = EV_WRITE,
+ DEQ_SIGNAL = EV_SIGNAL
};
-
+
struct callbackData {
void *userData;
void (*callback)(void*, const std::string eventId);
diff --git a/src/uscxml/concurrency/tinythread.h b/src/uscxml/concurrency/tinythread.h
index 71edf6c..0490e4d 100644
--- a/src/uscxml/concurrency/tinythread.h
+++ b/src/uscxml/concurrency/tinythread.h
@@ -24,6 +24,8 @@ freely, subject to the following restrictions:
#ifndef _TINYTHREAD_H_
#define _TINYTHREAD_H_
+#include "uscxml/Common.h"
+
/// @file
/// @mainpage TinyThread++ API Reference
///
@@ -161,7 +163,8 @@ unsigned long long int timeStamp();
/// program may deadlock if the thread that owns a mutex object calls lock()
/// on that object).
/// @see recursive_mutex
-class mutex {
+
+class USCXML_API mutex {
public:
/// Constructor.
mutex()
@@ -229,7 +232,7 @@ public:
#endif
}
- _TTHREAD_DISABLE_ASSIGNMENT(mutex)
+ //_TTHREAD_DISABLE_ASSIGNMENT(mutex)
private:
#if defined(_TTHREAD_WIN32_)
@@ -248,7 +251,7 @@ private:
/// may lock the mutex several times, as long as it unlocks the mutex the same
/// number of times).
/// @see mutex
-class recursive_mutex {
+class USCXML_API recursive_mutex {
public:
/// Constructor.
recursive_mutex() {
@@ -307,7 +310,7 @@ public:
#endif
}
- _TTHREAD_DISABLE_ASSIGNMENT(recursive_mutex)
+ //_TTHREAD_DISABLE_ASSIGNMENT(recursive_mutex)
private:
#if defined(_TTHREAD_WIN32_)
@@ -335,7 +338,7 @@ private:
/// @endcode
template <class T>
-class lock_guard {
+class USCXML_API lock_guard {
public:
typedef T mutex_type;
@@ -382,7 +385,7 @@ private:
/// cond.notify_all();
/// }
/// @endcode
-class condition_variable {
+class USCXML_API condition_variable {
public:
/// Constructor.
#if defined(_TTHREAD_WIN32_)
@@ -451,7 +454,7 @@ public:
}
#endif
- _TTHREAD_DISABLE_ASSIGNMENT(condition_variable)
+ //_TTHREAD_DISABLE_ASSIGNMENT(condition_variable)
private:
#if defined(_TTHREAD_WIN32_)
@@ -466,7 +469,7 @@ private:
/// Thread class.
-class thread {
+class USCXML_API thread {
public:
#if defined(_TTHREAD_WIN32_)
typedef HANDLE native_handle_type;
@@ -535,7 +538,7 @@ public:
/// @note If this value is not defined, the function returns zero (0).
static unsigned hardware_concurrency();
- _TTHREAD_DISABLE_ASSIGNMENT(thread)
+ //_TTHREAD_DISABLE_ASSIGNMENT(thread)
private:
native_handle_type mHandle; ///< Thread handle.
@@ -556,7 +559,7 @@ private:
/// Thread ID.
/// The thread ID is a unique identifier for each thread.
/// @see thread::get_id()
-class thread::id {
+class USCXML_API thread::id {
public:
/// Default constructor.
/// The default constructed ID is that of thread without a thread of
@@ -623,7 +626,7 @@ public:
namespace chrono {
/// Duration template class. This class provides enough functionality to
/// implement @c this_thread::sleep_for().
-template <class _Rep, class _Period = ratio<1> > class duration {
+template <class _Rep, class _Period = ratio<1> > class USCXML_API duration {
private:
_Rep rep_;
public: