libresman

view src/resman.h @ 20:c6073bf9fd38

finally! async loading works. Now on to inotify...
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 12 Feb 2014 16:02:12 +0200
parents 4d18498a0078
children fe0dbdfbe403
line source
1 #ifndef RESOURCE_MANAGER_H_
2 #define RESOURCE_MANAGER_H_
4 /* load callback: everything or just file read/parse stage
5 * done callback: second-stage callback, called in the context of the
6 * user thread, after the load callback returns
7 */
8 typedef int (*resman_load_func)(const char *fname, int id, void *closure);
9 typedef int (*resman_done_func)(int id, void *closure);
10 typedef void (*resman_destroy_func)(int id, void *closure);
12 struct resman;
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
18 struct resman *resman_create(void);
19 void resman_free(struct resman *rman);
21 int resman_init(struct resman *rman);
22 void resman_destroy(struct resman *rman);
24 void resman_set_load_func(struct resman *rman, resman_load_func func, void *cls);
25 void resman_set_done_func(struct resman *rman, resman_done_func func, void *cls);
26 void resman_set_destroy_func(struct resman *rman, resman_destroy_func func, void *cls);
28 int resman_lookup(struct resman *rman, const char *fname, void *data);
29 void resman_wait(struct resman *rman, int id);
31 int resman_poll(struct resman *rman);
33 const char *resman_get_res_name(struct resman *rman, int res_id);
35 void resman_set_res_data(struct resman *rman, int res_id, void *data);
36 void *resman_get_res_data(struct resman *rman, int res_id);
38 int resman_get_res_result(struct resman *rman, int res_id);
40 #ifdef __cplusplus
41 }
42 #endif
45 #endif /* RESOURCE_MANAGER_H_ */