[erlang-questions] driver_entry stop() and driver_async() interaction

Paul Fisher <>
Thu Nov 6 19:22:45 CET 2008

Can anyone comment on this question i sent a few weeks ago?

When the port owner terminates and there are driver_async() requests 
scheduled and not yet executed, I am seeing them outstanding at the time 
of the stop() callback.

Paul Fisher wrote:
> Question about work scheduled on async threads via driver_async() and
> still pending (i.e. they are still on the queue to be executed,) when
> the stop() callback is invoked.  Specifically, assuming smp w/async
> thread pool and the driver marked ERL_DRV_FLAG_USE_PORT_LOCKING.
> Is it the responsibility of the code in the stop() callback to call
> driver_async_cancel() on each outstanding async work item, or will this
> be done automatically by the emulator before the call to stop()?
> If this is the responsibility of the code in stop(), is it guaranteed
> that no async work item will be executing or scheduled during the call
> to the stop() callback?
> If no guarantee is made, is holding the PDL necessary and sufficient to
> guarantee this?


More information about the erlang-questions mailing list