libresman
annotate 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 |
rev | line source |
---|---|
nuclear@22 | 1 #ifndef RESMAN_IMPL_H_ |
nuclear@22 | 2 #define RESMAN_IMPL_H_ |
nuclear@22 | 3 |
nuclear@22 | 4 #include <pthread.h> |
nuclear@22 | 5 #include "rbtree.h" |
nuclear@22 | 6 #include "threadpool.h" |
nuclear@22 | 7 |
nuclear@22 | 8 #ifdef __linux__ |
nuclear@22 | 9 #include <unistd.h> |
nuclear@22 | 10 #include <fcntl.h> |
nuclear@22 | 11 #include <sys/inotify.h> |
nuclear@22 | 12 #endif |
nuclear@23 | 13 #ifdef WIN32 |
nuclear@23 | 14 #include <windows.h> |
nuclear@23 | 15 #endif |
nuclear@22 | 16 |
nuclear@22 | 17 struct resource { |
nuclear@22 | 18 int id; |
nuclear@22 | 19 char *name; |
nuclear@22 | 20 void *data; |
nuclear@22 | 21 int result; /* last callback-reported success/fail code */ |
nuclear@22 | 22 |
nuclear@22 | 23 int done_pending; |
nuclear@22 | 24 int delete_pending; |
nuclear@22 | 25 pthread_mutex_t lock; |
nuclear@22 | 26 |
nuclear@22 | 27 int num_loads; /* number of loads up to now */ |
nuclear@22 | 28 |
nuclear@22 | 29 /* file change monitoring */ |
nuclear@23 | 30 #ifdef WIN32 |
nuclear@23 | 31 char *watch_path; |
nuclear@22 | 32 #endif |
nuclear@22 | 33 #ifdef __linux__ |
nuclear@22 | 34 int nfd; |
nuclear@22 | 35 #endif |
nuclear@22 | 36 }; |
nuclear@22 | 37 |
nuclear@22 | 38 |
nuclear@22 | 39 struct resman { |
nuclear@22 | 40 struct resource **res; |
nuclear@22 | 41 struct thread_pool *tpool; |
nuclear@22 | 42 |
nuclear@22 | 43 pthread_mutex_t lock; /* global resman lock (for res array changes) */ |
nuclear@22 | 44 |
nuclear@22 | 45 resman_load_func load_func; |
nuclear@22 | 46 resman_done_func done_func; |
nuclear@22 | 47 resman_destroy_func destroy_func; |
nuclear@22 | 48 |
nuclear@22 | 49 void *load_func_cls; |
nuclear@22 | 50 void *done_func_cls; |
nuclear@22 | 51 void *destroy_func_cls; |
nuclear@22 | 52 |
nuclear@22 | 53 /* file change monitoring */ |
nuclear@22 | 54 struct rbtree *nresmap; |
nuclear@22 | 55 #ifdef __linux__ |
nuclear@22 | 56 int inotify_fd; |
nuclear@23 | 57 struct rbtree *modset; |
nuclear@23 | 58 #endif |
nuclear@23 | 59 #ifdef WIN32 |
nuclear@24 | 60 struct rbtree *watchdirs, *wdirbyev; |
nuclear@24 | 61 HANDLE *watch_handles; /* dynamic array of all the watched directory handles */ |
nuclear@22 | 62 #endif |
nuclear@22 | 63 }; |
nuclear@22 | 64 |
nuclear@22 | 65 |
nuclear@22 | 66 #endif /* RESMAN_IMPL_H_ */ |