初步确认future-promise的异步调用机制。目录和cmake待整理。
This commit is contained in:
20
interface/future.h
Normal file
20
interface/future.h
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
enum e_future_error
|
||||
{
|
||||
FUTURE_ERROR_CANCEL,
|
||||
FUTURE_ERROR_EXCEPTION,
|
||||
FUTURE_ERROR_TIMEOUT
|
||||
};
|
||||
struct promise;
|
||||
struct future;
|
||||
typedef void (*future_success_cb)(void * result, void * user);
|
||||
typedef void (*future_failed_cb)(enum e_future_error err, const char * what, void * user);
|
||||
typedef void (*promise_ctx_destroy_cb)(struct promise* p);
|
||||
|
||||
struct future* future_create(future_success_cb * cb_success, future_failed_cb * cb_failed, void * user);
|
||||
|
||||
struct future* promise_to_future(struct promise* p);
|
||||
struct promise* future_to_promise(struct future* f);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user