Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  driver_async() marks driver as permanent?

pfisher
Posted: Fri Apr 04, 2008 2:44 pm Reply with quote
User Joined: 12 Nov 2007 Posts: 57
Does using driver_async() from within a linked-in driver mark the driver
as permanent automatically? I am seeing an {error, permanent} out of
erl_ddll:unload_driver/1 even after all of the processes which called
open_port/2 have exited, and therefore all of the port instances using
the driver have stopped.

If this is done automatically, is there a way to "unmark" it, so that I
can still unload the driver?

If such automatic marking is is not done, can someone confirm?


--
paul


_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message
pfisher
Posted: Sat Apr 05, 2008 1:33 am Reply with quote
User Joined: 12 Nov 2007 Posts: 57
On Fri, 2008-04-04 at 09:41 -0500, Paul Fisher wrote:
> Does using driver_async() from within a linked-in driver mark the driver
> as permanent automatically? I am seeing an {error, permanent} out of
> erl_ddll:unload_driver/1 even after all of the processes which called
> open_port/2 have exited, and therefore all of the port instances using
> the driver have stopped.
>
> If this is done automatically, is there a way to "unmark" it, so that I
> can still unload the driver?

Answering my own question again... I got some time this evening to look
into this, and apparently the answer is yes. This little tidbit in
erts/emulator/beam/erl_async.c:async_add(), line 139 (R12B-1):

/* XXX:PaN Is this still necessary when ports lock drivers? */
if (is_internal_port(a->port)) {
ERTS_LC_ASSERT(erts_drvportid2port(a->port));
/* make sure the driver will stay around */
driver_lock_driver(internal_port_index(a->port));
}

which eventually winds its way down to this in erl_bif_ddll.c, line 1109

dh->procs = NULL;
erts_ddll_reference_driver(dh);
dh->status = ERL_DE_PERMANENT;

and there is not any place that removes that status value, that I can
find on brief inspection. (Basically only initialization/reload code
sets this field.)

So is the comment in async_add() proper and this could be removed? (I'd
appreciate some guidance on this as this is the first time i've mucked
around the runtime code and just don't have the background yet to make
informed decisions.)


--
paul

_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum