From 0f2c685db3d3790ce9bdc9598df8dae7d6b67eae Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 9 Oct 2011 12:33:48 +0000 Subject: On range tout le code actuel du trunk dans une branche nommée "0.x" et on crée une branche 1.x qui contiendra une nouvelle mouture (re-conception, méta info de packaging...). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-ddhardrescue/branches/0.x@29 d3078510-dda0-49f1-841c-895ef4b7ec81 --- src/slices_evt.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/slices_evt.c (limited to 'src/slices_evt.c') diff --git a/src/slices_evt.c b/src/slices_evt.c new file mode 100644 index 0000000..4ed07c6 --- /dev/null +++ b/src/slices_evt.c @@ -0,0 +1,29 @@ +#include "slices_evt.h" + +#include +#include + +// Event-aware version of sliceSplit (reusing it, of course) +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 ) { + switch(res) { + case 3: + slicesEvt->eventListener(slicesEvt, initialSlice->next->next); + case 2: + slicesEvt->eventListener(slicesEvt, initialSlice->next); + case 1: + slicesEvt->eventListener(slicesEvt, initialSlice); + break; + default: + // No events on split errors + break; + } + } + pthread_mutex_unlock(&(slicesEvt->eventListenerMutex)); + return res; +} + -- cgit v1.2.3