Clement Deschamps
Builds for 1 pipeline passed in 5 minutes 24 seconds

cleaned up

- removed thread_safe_event.h (now use greenthreads.h)
- added comments in sync.h
... ... @@ -191,15 +191,19 @@ public:
/* Ensure there are no pending token requests. */
takeLockMethod();
if (sem_timedwait(&(canLock()), &ts) == 0) {
int res = sem_timedwait(&(canLock()), &ts);
if (res == 0) {
/* critical we take the lock here, incase the 'kickLock' is about to post a notify */
mutex.lock();
sem_post(&(canLock()));
mutex.unlock();
/* we rely on checkWindowEvent being notified at the end of the transaction */
} else {
} else if (errno == ETIMEDOUT) {
checkWindowEvent.notify();
}
else {
SC_REPORT_ERROR("greenthreads", "sem_timedwait failed in checkWindow()");
}
}
}
... ... @@ -211,6 +215,7 @@ protected:
sc_core::sc_time front = sc_ts;
bool changed = false;
/* Update backWindow and frontWindow by iterating over all sources */
mutex.lock();
for (std::list<sc_core::sc_time>::iterator i = endTimes.begin(); i != endTimes.end(); ++i) {
if (*i < back) {
... ... @@ -231,6 +236,7 @@ protected:
sc_is_back_window = (sc_ts == backWindow);
mutex.unlock();
/* If back or front window changed, wake-up pending threads */
if (changed) {
ahead.release();
kickLock();
... ...
/* temporarily for legacy */
#ifndef GS_GT_THREAD_SAFE_EVENT_H
#define GS_GT_THREAD_SAFE_EVENT_H
#include "greenthreads/greenthreads.h"
namespace gs {
namespace gt {
typedef async_event event_async;
}
}
#endif