eclipsesource / eclipsesource/J2V8
Is there any risks to change the uv_run mode to UV_RUN_NOWAIT in pumpMessageLoop?
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 387
- PR merge metrics
- No merged PRs in 30d
Description
I want to run node on Android.
Code first:
```
Thread nodeThread = new Thread() {
@Override
public void run() {
...
while (true) {
Runnable r = mQueue.poll();
if (r != null) {
r.run();
}
mNode.handleMessage();
}
}
};
```
I start a thread for the node loop.
And the runnable offered to the mQueue is like:
```
mNode.getRuntime().executeVoidScript(script);//eg. when java want to callback to js
```
But the mNode.handleMessage() may block the runnable.
So I have to do this as the following:
com_eclipsesource_v8_V8Impl.cpp : pumpMessageLoop
`rt->running = uv_run(rt->uvLoop, UV_RUN_ONCE);`
change to
`rt->running = uv_run(rt->uvLoop, UV_RUN_NOWAIT);`
It just works fine till now. But I 'am not sure.
Contributor guide
Assessment
This issue has not been assessed yet.