代码拉取完成,页面将自动刷新
同步操作将从 Xingwa/ani_cookbook 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include <ani.h>
#include <array>
#include <iostream>
typedef void (*ani_async_workaround_execute_callback)(ani_env env,
void* data);
typedef void (*ani_async__workaround_complete_callback)(ani_env env,
ani_status status,
void* data);
struct native_data {
void *data;
ani_async_workaround_execute_callback execute;
ani_async__workaround_complete_callback complete;
};
typedef native_data ani_sync_work_handle_t;
ani_status ani_create_sync_work_handle(
ani_async_workaround_execute_callback excute,
ani_async__workaround_complete_callback complete,
void *data,
ani_sync_work_handle_t **result){
auto w = new native_data();
w->execute = excute;
w->complete = complete;
w->data;
*result = w;
return ANI_OK;
}
static void execute(ani_env *env, ani_object obj)
{
}
static int complete(ani_env *env, ani_object obj)
{
return 0;
}
static void AsyncTest(ani_env *env, ani_class cls, ani_object obj)
{
}
ANI_EXPORT ani_status ANI_Constructor(ani_vm *vm, uint32_t *result)
{
ani_env *env;
if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) {
std::cerr << "Unsupported ANI_VERSION_1" << std::endl;
return ANI_ERROR;
}
static const char *className = "Lasync_work_helper/AsyncWorkHelper;";
ani_class cls;
if (ANI_OK != env->FindClass(className, &cls)) {
std::cerr << "Not found '" << className << "'" << std::endl;
return ANI_ERROR;
}
std::array methods = {
ani_native_function {"execute", ":V", reinterpret_cast<void *>(execute)},
ani_native_function {"complete", ":I", reinterpret_cast<void *>(complete)},
ani_native_function {"AsyncTest", "Lasync_work_helper/AsyncWorkHelper;:V", reinterpret_cast<void *>(AsyncTest)},
};
if (ANI_OK != env->Class_BindNativeMethods(cls, methods.data(), methods.size())) {
std::cerr << "Cannot bind native methods to '" << className << "'" << std::endl;
return ANI_ERROR;
};
*result = ANI_VERSION_1;
return ANI_OK;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。