* threads support with mutexes
This commit is contained in:
alessandrobason 2021-10-27 11:45:27 +01:00
parent 59b55c7f6c
commit bb6f3f967c
5 changed files with 248 additions and 31 deletions

View file

@ -28,6 +28,7 @@ extern "C" {
*/
#include <stdbool.h>
#include "cthreads.h"
enum {
DIRWATCH_FILE_ADDED,
@ -48,7 +49,7 @@ typedef struct {
} dirwatch_desc_t;
typedef struct {
void *handle;
cthread_t handle;
dirwatch_desc_t *desc;
} dirwatch_t;
@ -59,4 +60,8 @@ dirwatch_t watchDir(dirwatch_desc_t desc);
void waitForWatchDir(dirwatch_t *ctx);
// stops dirwatch thread, if immediately is true, it will try to close it right away
// otherwise it might wait for one last event
void stopWatchDir(dirwatch_t *ctx, bool immediately);
void stopWatchDir(dirwatch_t *ctx, bool immediately);
#ifdef __cplusplus
} // extern "C"
#endif