libresman
view src/resman_impl.h @ 25:1be0a35aa216
removed a random debug printf left in the code
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 13 Feb 2014 21:34:41 +0200 |
parents | f8e5a1491275 |
children | 6b9974a8bdae |
line source
1 #ifndef RESMAN_IMPL_H_
2 #define RESMAN_IMPL_H_
4 #include <pthread.h>
5 #include "rbtree.h"
6 #include "threadpool.h"
8 #ifdef __linux__
9 #include <unistd.h>
10 #include <fcntl.h>
11 #include <sys/inotify.h>
12 #endif
13 #ifdef WIN32
14 #include <windows.h>
15 #endif
17 struct resource {
18 int id;
19 char *name;
20 void *data;
21 int result; /* last callback-reported success/fail code */
23 int done_pending;
24 int delete_pending;
25 pthread_mutex_t lock;
27 int num_loads; /* number of loads up to now */
29 /* file change monitoring */
30 #ifdef WIN32
31 char *watch_path;
32 #endif
33 #ifdef __linux__
34 int nfd;
35 #endif
36 };
39 struct resman {
40 struct resource **res;
41 struct thread_pool *tpool;
43 pthread_mutex_t lock; /* global resman lock (for res array changes) */
45 resman_load_func load_func;
46 resman_done_func done_func;
47 resman_destroy_func destroy_func;
49 void *load_func_cls;
50 void *done_func_cls;
51 void *destroy_func_cls;
53 /* file change monitoring */
54 struct rbtree *nresmap;
55 #ifdef __linux__
56 int inotify_fd;
57 struct rbtree *modset;
58 #endif
59 #ifdef WIN32
60 struct rbtree *watchdirs, *wdirbyev;
61 HANDLE *watch_handles; /* dynamic array of all the watched directory handles */
62 #endif
63 };
66 #endif /* RESMAN_IMPL_H_ */