This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/interface/future.cpp

37 lines
664 B
C++
Raw Normal View History

2018-08-01 17:47:38 +08:00
enum e_future_error
{
FUTURE_ERROR_CANCEL
FUTURE_ERROR_EXCEPTION,
FUTURE_ERROR_TIMEOUT
}
typedef void (*future_cb_success_t)(void * result, void * user);
typedef void (*future_cb_failed_t)(enum e_future_error err, const char * what, void * user);
struct future
{
void * user;
future_cb_success_t * cb_success;
future_cb_failed_t * cb_failed;
};
struct promise
{
struct future f;
void * ctx;
}
typedef void * promise_t;
void future_cancel(struct future * future)
{
future->cancel();
}
void promise_success(struct promisc *, void * result);
void promise_fail();
struct future * XXXXXRpc()
{
cancel = ___XXXXCancel()
};