[erlang-questions] ready_async() before outputv() calling driver_async() completes?

Paul Fisher <>
Thu Oct 16 13:45:17 CEST 2008


Raimo Niskanen wrote:
> On Wed, Oct 15, 2008 at 06:08:31PM -0500, Paul Fisher wrote:
>> Should it be possible for a ready_async() callback to happen before the
>> outputv() callback which called driver_async() has returned?  I am
>> seeing this happen on R12B-2 smp runtime (2 schedulers), w/four (4)
>> async threads.
> 
> And even if the SMP emulator does not do it explicitly,
> it is always possible for the thread calling outputv()
> to get scheduled out between the return from driver_async()
> and the return from outputv(), and the asynchronous
> thread to get scheduled in, do its thing and call ready_async()
> right then.

I am talking about SMP with async threads only.

The documentation says that the ready_async() callback happens from the 
emulator thread.

"This function is called from the erlang emulator thread, as opposed to 
the asynchronous function, which is called in some thread (if 
multithreading is enabled)."


All other indications in the documentation make me believe that only one 
callback from an emulator thread is active in a callback at a time (for 
each port instance that is).

"There will only be one thread at a time calling driver call-backs 
corresponding to the same port, though."


So you are saying that ready_async() is an exception to this?


--
paul



More information about the erlang-questions mailing list