From 81f4a89125ba32955af21fef6cc631e050973a47 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 28 Nov 2011 18:18:46 +0100 Subject: erts: Deprecate the NIF reload mechanism The reload mechanism is an odd feature that does not harmonize with how module upgrade is otherwise done. We do not want its presence to hinder future development of code loading and upgrade. --- erts/doc/src/erl_nif.xml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index 8daa67aa87..5fc6508aad 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -136,9 +136,7 @@ ok then retrieved by calling enif_priv_data.

There is no way to explicitly unload a NIF library. A library will be automatically unloaded when the module code that it belongs to is purged - by the code server. A NIF library will also be unloaded if it is replaced - by another version of the library by a second call to - erlang:load_nif/2 from the same module code.

+ by the code server.

FUNCTIONALITY @@ -308,21 +306,9 @@ ok initialization is needed.

- int (*reload)(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) -

reload is called when the NIF library is loaded - and there is already a previously loaded library for this - module code.

-

Works the same as load. The only difference is that - *priv_data already contains the value set by the - previous call to load or reload.

-

The library will fail to load if reload returns - anything other than 0 or if reload is NULL.

-
- int (*upgrade)(ErlNifEnv* env, void** priv_data, void** old_priv_data, ERL_NIF_TERM load_info)

upgrade is called when the NIF library is loaded - and there is no previously loaded library for this module - code, BUT there is old code of this module with a loaded NIF library.

+ and there is old code of this module with a loaded NIF library.

Works the same as load. The only difference is that *old_priv_data already contains the value set by the last call to load or reload for the old module @@ -339,6 +325,23 @@ ok called for a replaced library as a consequence of reload.

+ int (*reload)(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info) +

The reload mechanism is deprecated. It was only intended + as a development feature. Do not use it as an upgrade method for + live production systems. It might be removed in future releases. Be sure + to pass reload as NULL to ERL_NIF_INIT + to disable it when not used.

+
+

reload is called when the NIF library is loaded + and there is already a previously loaded library for this + module code.

+

Works the same as load. The only difference is that + *priv_data already contains the value set by the + previous call to load or reload.

+

The library will fail to load if reload returns + anything other than 0 or if reload is NULL.

+
+
-- cgit v1.2.3