commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <>
Subject Re: [javaflow] - how to use continuation in JNI boundary
Date Sat, 20 Jan 2018 18:51:52 GMT
> because the stack when is suspended is out from native func.
> instead if i call suspend inside a JNI c++ class the stack is not visible
> from java so probably javaflow dont work.

The short answer to that question is "yes".

> I have another different question:
> run(){
> while(!stream.eof()){
>    data=read(stream);
>   process(data);
> }.
> stream is synchonized internally waiting until data is not empty.

How is that example even related to javaflow?
What's the goal here?

My question is: normally in synchonized blocks the thread is blocked until
> notify but inside a coroutine the class is instrumented for not blocking
> the thread but just for suspending the coroutine until notify?

That doesn't sound quite right.
While it is true that calls to a synchronized function will have to wait
for a lock on "this",
I would not use terms "synchronized" and "blocking" like that.

Maybe let's try give a birds eye view on how javaflow works.

1. On suspend the function will exit but also store state information in
the Continuation object.
2. On resume the library will call the function again, but it will restore
the state and jump to the position after it was suspended.

The synchronization characteristics should not be affected by that.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message