提交 a6f00f1f 编写于 作者: H hekun

test case

Signed-off-by: Nhekun <hekun18@huawei.com>
上级 0e265f2d
...@@ -1396,8 +1396,9 @@ static napi_value napiDefineClass(napi_env env, napi_callback_info info) ...@@ -1396,8 +1396,9 @@ static napi_value napiDefineClass(napi_env env, napi_callback_info info)
static napi_value napiRunScriptPath(napi_env env, napi_callback_info info) static napi_value napiRunScriptPath(napi_env env, napi_callback_info info)
{ {
napi_value value; napi_value value;
const char* path = "test/path"; //char const* path = "/index/name";
napi_status status = napi_run_script_path(env, &path, &value); const char* path = "22";
napi_status status = napi_run_script_path(env, path, &value);
NAPI_ASSERT(env, status == napi_ok, "napi_run_script_path ok"); NAPI_ASSERT(env, status == napi_ok, "napi_run_script_path ok");
napi_value _value; napi_value _value;
...@@ -1439,16 +1440,16 @@ static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info in ...@@ -1439,16 +1440,16 @@ static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info in
return value; return value;
} }
static void TsFuncFinalTotalFour(napi_env env) static void TsFuncFinalTotalFour(napi_env env, void* finalizeData, void* hint)
{ {
static uv_thread_t guvThreadTest7; static uv_thread_t guvThreadTest7;
uv_thread_join(&guvThreadTest7); uv_thread_join(&guvThreadTest7);
} }
static void TsFuncCallJsFour(napi_env env, napi_value tsfn_cb) static void TsFuncCallJsFour(napi_env env, napi_value tsfn_cb, void* context, void* data)
{ {
napi_value value; int* pData = (int*)data;
NAPI_CALL(env, napi_create_int32(env, 0, &value)); printf("TsFuncCallJsFour is %p \n", pData);
} }
static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info info) static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info info)
...@@ -1459,7 +1460,7 @@ static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info ...@@ -1459,7 +1460,7 @@ static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info
int32_t callJstCbDataTestId = 101; int32_t callJstCbDataTestId = 101;
int32_t finalCbtDataTestID = 1001; int32_t finalCbtDataTestID = 1001;
napi_status status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, napi_status status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName,
0, 1, &callJstCbDataTestId, TsFuncFinalTotalFour, 0, 1, &callJstCbDataTestId, TsFuncFinalTotalFour,
&finalCbtDataTestID, TsFuncCallJsFour, &tsFunc); &finalCbtDataTestID, TsFuncCallJsFour, &tsFunc);
NAPI_ASSERT(env, status == napi_ok, "napi_create_threadsafe_function"); NAPI_ASSERT(env, status == napi_ok, "napi_create_threadsafe_function");
...@@ -1516,9 +1517,8 @@ static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info inf ...@@ -1516,9 +1517,8 @@ static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info inf
napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName); napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
int32_t callJsCbDataTestId = 101; int32_t callJsCbDataTestId = 101;
int32_t finalCbDataTestId = 1001; int32_t finalCbDataTestId = 1001;
napi_status status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, napi_status status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName,
0, 1, &callJsCbDataTestId, TsFuncFinalTotalFour, 0, 1, &callJsCbDataTestId, TsFuncFinalTotalFour, &finalCbDataTestId, TsFuncCallJsFour, &tsFunc);
&finalCbDataTestId, TsFuncCallJsFour, &tsFunc);
NAPI_ASSERT(env, status == napi_ok, "napi_create_threadsafe_function"); NAPI_ASSERT(env, status == napi_ok, "napi_create_threadsafe_function");
status = napi_ref_threadsafe_function(env, tsFunc); status = napi_ref_threadsafe_function(env, tsFunc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册