示例#1
0
文件: task.cpp 项目: shengofsun/rDSN
aio_task::aio_task(dsn::task_code code, aio_handler &&cb, int hash, service_node *node)
    : task(code, hash, node), _cb(std::move(cb))
{
    _is_null = (_cb == nullptr);

    dassert(TASK_TYPE_AIO == spec().type,
            "%s is not of AIO type, please use DEFINE_TASK_CODE_AIO to define the task code",
            spec().name.c_str());
    set_error_code(ERR_IO_PENDING);

    auto disk = get_current_disk();
    _aio = disk->prepare_aio_context(this);
}
示例#2
0
文件: task.cpp 项目: am11/rDSN
aio_task::aio_task(
    dsn_task_code_t code, 
    dsn_aio_handler_t cb, 
    void* context, 
    dsn_task_cancelled_handler_t on_cancel,
    int hash,
    service_node* node
    )
    : task(code, context, on_cancel, hash, node)
{
    _cb = cb;
    _is_null = (_cb == nullptr);

    dassert (TASK_TYPE_AIO == spec().type, 
        "%s is not of AIO type, please use DEFINE_TASK_CODE_AIO to define the task code",
        spec().name.c_str()
        );
    set_error_code(ERR_IO_PENDING);

    auto disk = get_current_disk();
    if (!disk) disk = node->node_disk();
    _aio = disk->prepare_aio_context(this);
}