nuclear@22: #ifndef RESMAN_IMPL_H_ nuclear@22: #define RESMAN_IMPL_H_ nuclear@22: nuclear@22: #include nuclear@22: #include "rbtree.h" nuclear@22: #include "threadpool.h" nuclear@22: nuclear@22: #ifdef __linux__ nuclear@22: #include nuclear@22: #include nuclear@22: #include nuclear@22: #endif nuclear@23: #ifdef WIN32 nuclear@23: #include nuclear@23: #endif nuclear@22: nuclear@22: struct resource { nuclear@22: int id; nuclear@22: char *name; nuclear@22: void *data; nuclear@22: int result; /* last callback-reported success/fail code */ nuclear@22: nuclear@22: int done_pending; nuclear@22: int delete_pending; nuclear@22: pthread_mutex_t lock; nuclear@22: nuclear@22: int num_loads; /* number of loads up to now */ nuclear@22: nuclear@22: /* file change monitoring */ nuclear@23: #ifdef WIN32 nuclear@23: char *watch_path; nuclear@22: #endif nuclear@22: #ifdef __linux__ nuclear@22: int nfd; nuclear@22: #endif nuclear@22: }; nuclear@22: nuclear@22: nuclear@22: struct resman { nuclear@22: struct resource **res; nuclear@22: struct thread_pool *tpool; nuclear@22: nuclear@22: pthread_mutex_t lock; /* global resman lock (for res array changes) */ nuclear@22: nuclear@22: resman_load_func load_func; nuclear@22: resman_done_func done_func; nuclear@22: resman_destroy_func destroy_func; nuclear@22: nuclear@22: void *load_func_cls; nuclear@22: void *done_func_cls; nuclear@22: void *destroy_func_cls; nuclear@22: nuclear@22: /* file change monitoring */ nuclear@22: struct rbtree *nresmap; nuclear@22: #ifdef __linux__ nuclear@22: int inotify_fd; nuclear@23: struct rbtree *modset; nuclear@23: #endif nuclear@23: #ifdef WIN32 nuclear@24: struct rbtree *watchdirs, *wdirbyev; nuclear@24: HANDLE *watch_handles; /* dynamic array of all the watched directory handles */ nuclear@22: #endif nuclear@22: }; nuclear@22: nuclear@22: nuclear@22: #endif /* RESMAN_IMPL_H_ */