diff options
Diffstat (limited to 'test/cothreads/object.h')
-rw-r--r-- | test/cothreads/object.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/cothreads/object.h b/test/cothreads/object.h new file mode 100644 index 000000000..9b4ebb6b6 --- /dev/null +++ b/test/cothreads/object.h @@ -0,0 +1,30 @@ +#ifndef __OBJECT_H__ +#define __OBJECT_H__ + +#include "cothreads.h" + +#define OBJECT(obj) ((object*)(obj)) + +typedef struct _object object; + +typedef void (*object_loopfunc)(object *obj); + +struct _object { + cothread_state *threadstate; + object_loopfunc loopfunc; + + char *name; + object *peer; + + void *pen; +}; + +void object_init(object *obj,char *name,cothread_context *ctx); +object *object_create(char *name,cothread_context *ctx); +void object_setloopfunc(object *obj,object_loopfunc func); +void object_setpeer(object *obj,object *peer); +void object_push(object *obj,char *buf); +char *object_pull(object *obj); +int object_loop_function(int argc,char **argv); + +#endif /* __OBJECT_H__ */ |