emscripten-core / emscripten-core/emscripten

How to call JS function in C subThread?

Open
#21,154 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

In JS code, there is a function JS_test()
`JS_test(a,b,c)
{
let res = a + b + c;
console.log("result:" + res);
return 1;
}`

In C code ,there is a subThread:
`void *C_threadFunc(void* arg)
{
//call JS Function
JS_test(1,2,3);///how???????????
return arg;
}
int C_testThread() {
//create thread
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_create(&thread_id, &attr, threadFunc, NULL);
return 1;
}`

How to call JS_test() in C subThread?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.