summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slices_evt.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/slices_evt.c b/src/slices_evt.c
index 43cb568..9174903 100644
--- a/src/slices_evt.c
+++ b/src/slices_evt.c
@@ -1,10 +1,15 @@
+//XXX Suprress that when event queue is terminated
+#include <stdio.h>
+#include <pthread.h>
+
#include "slices_evt.h"
-int sliceSplitEvt(slices_evt_t *slicesEvt, slice_t *initialSlice, address_t splitAt, sliceStatus_t statusBefore, sliceStatus_t statusAt, sliceStatus_t statusAfter) {
+int sliceEvtSplit(slices_evt_t *slicesEvt, slice_t *initialSlice, address_t splitAt, sliceStatus_t statusBefore, sliceStatus_t statusAt, sliceStatus_t statusAfter) {
int res;
res=sliceSplit(slicesEvt->data, initialSlice, splitAt, statusBefore, statusAt, statusAfter);
+
+ pthread_mutex_lock(&(slicesEvt->eventListenerMutex));
if ( slicesEvt->eventListener != NULL ) {
- //FIXME : this could be dereference a NULL pointer. Implement a real listener system with a thread-safe FIFO
switch(res) {
case 3:
slicesEvt->eventListener(slicesEvt, initialSlice->next->next);
@@ -18,5 +23,12 @@ int sliceSplitEvt(slices_evt_t *slicesEvt, slice_t *initialSlice, address_t spli
break;
}
}
+ pthread_mutex_unlock(&(slicesEvt->eventListenerMutex));
return res;
}
+
+/*
+void sliceEvtPutEvent(slices_evt_t *slicesEvt, slice_t *modifiedSlice) {
+ printf("sliceEvtPutEvent %p %p\n", slicesEvt, modifiedSlice);
+}
+*/