From 2a96208cb00220f963e723ae0530492c5c70df27 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 11 Feb 2010 13:30:32 +0000 Subject: OTP-8335 Even more NIF features --- erts/doc/src/erl_driver.xml | 9 +- erts/doc/src/erl_nif.xml | 511 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 481 insertions(+), 39 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index 5d7a11b70a..63108f41f0 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -299,6 +299,8 @@ typedef struct ErlDrvSysInfo { int smp_support; int async_threads; int scheduler_threads; + int nif_major_version; + int nif_minor_version; } ErlDrvSysInfo; @@ -365,9 +367,14 @@ typedef struct ErlDrvSysInfo { (the same as returned by erlang:system_info(schedulers)). + nif_major_version + The value of ERL_NIF_MAJOR_VERSION when the runtime system was compiled. + + nif_minor_version + The value of ERL_NIF_MINOR_VERSION when the runtime system was compiled. + - ErlDrvBinary

diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index 2902d70976..c013d96fc4 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -41,7 +41,9 @@

R13B04: The function prototypes of the NIFs have changed to expect argc and argv arguments. The arity of a NIF is by that no longer limited to - 3.

+ 3.

+

enif_get_data renamed as enif_priv_data.

+

A NIF library contains native implementation of some functions of an erlang module. The native implemented functions (NIFs) are @@ -113,16 +115,71 @@ ok dynamic library will mean that static data defined by the library will be shared as well. To avoid unintentionally shared static data, each Erlang module code can keep its own private data. This - global private data can be set when the NIF library is loaded and - then retrieved by calling enif_get_data().

-

There is currently 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 can also be unloaded by replacing it with another - version of the library by a second call to + private data can be set when the NIF library is loaded and + 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.

- +
+ FUNCTIONALITY +

All functions that a NIF library needs to do with Erlang are + performed through the NIF API functions. There are functions + for the following functionality:

+ + Read and write Erlang terms +

Any Erlang terms can be passed to a NIF as function arguments and + be returned as function return value. The terms are of C-type ERL_NIF_TERM + and can only be read or written using API functions. Most functions to read + the content of a term are prefixed enif_get_ and usually return + true (or false) if the term was of the expected type (or not). + The functions to write terms are all prefixed enif_make_ and usually + return the created ERL_NIF_TERM. There are also some functions + to query terms, like enif_is_atom, enif_is_identical and + enif_compare.

+ Resource objects +

Resource objects are a way to return pointers to native data + structures from a NIF in a safe way. A resource object is just a block + of memory allocated with enif_alloc_resource(). + A handle ("safe pointer") to this memory block can then be returned to Erlang by the use of + enif_make_resource(). + The term returned by enif_make_resource + is totally opaque in nature. It can be stored and passed between processses + on the same node, but the only real end usage is to pass it back as argument to a NIF. + The NIF can then do enif_get_resource() + and get back a pointer to the memory block that is guaranteed to still be + valid. A resource object will not be deallocated until the last handle term + has been garbage collected by the VM and the resource has been + released with enif_release_resource() + (not necessarily in that order).

+

All resource objects are created as instances of some resource type. + This makes resources from different modules or applications to be distinguishable. + A resource type is created by calling + enif_open_resource_type() + when a library is loaded. Objects of that resource type can then later be allocated + and enif_get_resource verifies that the resource is of the expected type. + A resource type can have a destructor function that is automatically + called when resources of that type are released (by either the garbage + collector or enif_release_resource). Resource types also support + upgrade in runtime by allowing a loaded NIF library to takeover an already + existing resource type and thereby "inherit" all existing objects of that type. + The destructor of the new library will thereafter be called for the inherited + objects and the library with the old destructor function can be safely + unloaded. Resource types are uniquely identified by a supplied name string. +

+
+ Threads and concurrency +

A NIF is thread-safe without any explicit synchronization as + long as it acts as a pure function and only operates on the supplied + arguments. As soon as you access a shared state either through static + variables or enif_priv_data + you need to supply your own explicit synchronization.

+

The library initialization callbacks load, reload and + upgrade are all thread-safe even for shared state data.

+
+
INITIALIZATION @@ -146,7 +203,7 @@ ok and there is no previously loaded library for this module.

*priv_data can be set to point to some private data that the library needs in able to keep a state between NIF - calls. enif_get_data() will return this pointer.

+ calls. enif_priv_data() will return this pointer.

load_info is the second argument to erlang:load_nif/2.

The library will fail to load if load returns @@ -168,13 +225,11 @@ ok 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.

+ code, BUT 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 - code. It is allowed to write to both *priv_data and - *old_priv_data.

+ code. It is allowed to write to both *priv_data and *old_priv_data.

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

@@ -185,7 +240,6 @@ ok of the same module may or may not exist.

-
@@ -193,6 +247,14 @@ ok DATA TYPES + ERL_NIF_TERM + +

Variables of type ERL_NIF_TERM can refer to any Erlang term. + This is an opaque type and values of it can only by used either as + arguments to API functions or as return values from NIFs. A variable of + type ERL_NIF_TERM is only valid until the NIF call, where it was + obtained, returns.

+
ErlNifEnv

ErlNifEnv contains information about the context in @@ -236,15 +298,41 @@ typedef struct { inspected binary term. data is a pointer to a buffer of size bytes with the raw content of the binary.

- ERL_NIF_TERM + ErlNifResourceType -

Variables of type ERL_NIF_TERM can refere to any - Erlang term. This is an opaque type and values of it can only - by used either as arguments to API functions or as return - values from NIFs. A variable of type ERL_NIF_TERM is - only valid until the NIF call, where it was obtained, - returns.

-
+

Each instance of ErlNifResourceType represent a class of + memory managed resource objects that can be garbage collected. + Each resource type has a unique name and a destructor function that + is called when objects of its type are released.

+
+ ErlNifResourceDtor + +

+ +typedef void ErlNifResourceDtor(ErlNifEnv* env, void* obj); + +

The function prototype of a resource destructor function. + A destructor function is not allowed to call any term-making functions.

+
+ ErlNifCharEncoding + +

+ +typedef enum { + ERL_NIF_LATIN1 +}ErlNifCharEncoding; + +

The character encoding used in strings. The only supported + encoding is currently ERL_NIF_LATIN1 for iso-latin-1 + (8-bit ascii).

+
+ ErlNifSysInfo + +

Used by enif_system_info + to return information about the runtime system. Contains currently + the exact same content as ErlDrvSysInfo.

+
+ @@ -257,7 +345,18 @@ typedef struct { Create a new binary.

Allocate a new binary of size of size bytes. Initialize the structure pointed to by bin to - refer to the allocated binary. Return false if allocation failed.

+ refer to the allocated binary. The binary must either be released by + enif_release_binary() + or ownership transferred to an erlang term with + enif_make_binary(). + An allocated (and owned) ErlNifBinary can be kept between NIF + calls.

+

Return false if allocation failed.

+ + + void*enif_alloc_resource(ErlNifEnv* env, ErlNifResourceType* type, unsigned size) + Allocate a memory managed resource object +

Allocate a memory managed resource object of type type and size size bytes.

intenif_compare(ErlNifEnv* env, ERL_NIF_TERM lhs, ERL_NIF_TERM rhs) Compare two terms @@ -267,13 +366,50 @@ typedef struct { operators ==, /=, =<, <, >= and > (but not =:= or =/=).

+ voidenif_cond_broadcast(ErlNifCond *cnd) + +

Same as erl_drv_cond_broadcast(). +

+
+ ErlNifCond*enif_cond_create(char *name) + +

Same as erl_drv_cond_create(). +

+
+ voidenif_cond_destroy(ErlNifCond *cnd) + +

Same as erl_drv_cond_destroy(). +

+
+ voidenif_cond_signal(ErlNifCond *cnd) + +

Same as erl_drv_cond_signal(). +

+
+ voidenif_cond_wait(ErlNifCond *cnd, ErlNifMutex *mtx) + +

Same as erl_drv_cond_wait(). +

+
+ intenif_equal_tids(ErlNifTid tid1, ErlNifTid tid2) + +

Same as erl_drv_equal_tids(). +

+
voidenif_free(ErlNifEnv* env, void* ptr) Free dynamic memory

Free memory allocated by enif_alloc.

- void*enif_get_data(ErlNifEnv* env) - Get the private data of a NIF library -

Return the pointer to the private data that was set by load, reload or upgrade.

+ intenif_get_atom(ErlNifEnv* env, + ERL_NIF_TERM term, char* buf, unsigned size) + + Get the text representation of an atom term +

Write a null-terminated string, in the buffer pointed to by + buf of size size, consisting of the string + representation of the atom term. Return the number of bytes + written (including terminating null character) or 0 if + term is not an atom with maximum length of + size-1.

intenif_get_double(ErlNifEnv* env, ERL_NIF_TERM term, double* dp) Read a floating-point number term. @@ -292,16 +428,49 @@ typedef struct { list or return false if list is not a non-empty list.

+ intenif_get_long(ErlNifEnv* env, ERL_NIF_TERM term, long int* ip) + Read an long integer term. +

Set *ip to the long integer value of + term or return false if term is not an integer or is + outside the bounds of type long int.

+
+ intenif_get_resource(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifResourceType* type, void** objp) + Get the pointer to a resource object +

Set *objp to point to the resource object referred to by term. + Return false if term is not a handle to a resource object of type type.

+
+ intenif_get_string(ErlNifEnv* env, + ERL_NIF_TERM list, char* buf, unsigned size, + ErlNifCharEncoding encode) + Get a C-string from a list. +

Write a null-terminated string, in the buffer pointed to by + buf with size size, consisting of the characters + in the string list. The characters are written using encoding + encode. Return the number of bytes written + (including terminating null character), or -size if the + string was truncated due to buffer space, or 0 if list + is not a string that can be encoded with encode or + if size was less than 1. + The written string is always null-terminated unless buffer + size is less than 1.

+
intenif_get_tuple(ErlNifEnv* env, ERL_NIF_TERM term, int* arity, const ERL_NIF_TERM** array) Inspect the elements of a tuple.

If term is a tuple, set *array to point to an array containing the elements of the tuple and set *arity to the number of elements. Note that the array - is read-only an (*array)[N-1] will be the Nth element of + is read-only and (*array)[N-1] will be the Nth element of the tuple. *array is undefined if the arity of the tuple is zero.

Return false if term is not a tuple.

+ intenif_get_uint(ErlNifEnv* env, ERL_NIF_TERM term, unsigned int* ip) + Read an unsigned integer term. +

Set *ip to the unsigned integer value of + term or return false if term is not an unsigned integer or is + outside the bounds of type unsigned int

+
+ intenif_get_ulong(ErlNifEnv* env, ERL_NIF_TERM term, unsigned long* ip) Read an unsigned integer term.

Set *ip to the unsigned long integer value of @@ -310,10 +479,21 @@ typedef struct { intenif_inspect_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, ErlNifBinary* bin) Inspect the content of a binary -

Initialize the structure pointed to by bin with - transient information about the binary term +

Initialize the structure pointed to by bin with + information about the binary term bin_term. Return false if bin_term is not a binary.

+ intenif_inspect_iolist_as_binary(ErlNifEnv* + env, ERL_NIF_TERM term, ErlNifBinary* bin) + + Inspect the content of an iolist +

Initialize the structure pointed to by bin with one + continuous buffer with the same byte content as iolist. As with + inspect_binary, the data pointed to by bin is transient and does + not need to be released. Return false if iolist is not an + iolist.

+
+
intenif_is_atom(ErlNifEnv* env, ERL_NIF_TERM term) Determine if a term is an atom

Return true if term is an atom.

@@ -322,19 +502,36 @@ typedef struct { Determine if a term is a binary

Return true if term is a binary

+ intenif_is_empty_list(ErlNifEnv* env, ERL_NIF_TERM term) + Determine if a term is an empty list +

Return true if term is an empty list.

+
+ intenif_is_fun(ErlNifEnv* env, ERL_NIF_TERM term) + Determine if a term is a fun +

Return true if term is a fun.

+
intenif_is_identical(ErlNifEnv* env, ERL_NIF_TERM lhs, ERL_NIF_TERM rhs) Erlang operator =:= -

Return true if and only if the two terms are - identical. Corresponds to the Erlang operators =:= and +

Return true if the two terms are identical. Corresponds to the + Erlang operators =:= and =/=.

+ intenif_is_pid(ErlNifEnv* env, ERL_NIF_TERM term) + Determine if a term is a pid +

Return true if term is a pid.

+
+ intenif_is_port(ErlNifEnv* env, ERL_NIF_TERM term) + Determine if a term is a port +

Return true if term is a port.

+
+ intenif_is_ref(ErlNifEnv* env, ERL_NIF_TERM term) Determine if a term is a reference

Return true if term is a reference.

ERL_NIF_TERMenif_make_atom(ErlNifEnv* env, const char* name) Create an atom term -

Create an atom term from the C-string name. Atom +

Create an atom term from the C-string name. Unlike other terms, atom terms may be saved and used between NIF calls.

ERL_NIF_TERMenif_make_badarg(ErlNifEnv* env) @@ -343,8 +540,10 @@ typedef struct { ERL_NIF_TERMenif_make_binary(ErlNifEnv* env, ErlNifBinary* bin) Make a binary term. -

Make a binary term from bin. Will also release - the binary.

+

Make a binary term from bin. Any ownership of + the binary data will be transferred to the created term and + bin should be considered read-only for the rest of the NIF + call and then as released.

ERL_NIF_TERMenif_make_double(ErlNifEnv* env, double d) Create an floating-point term @@ -367,18 +566,62 @@ typedef struct { cnt number of arguments (after cnt) of type ERL_NIF_TERM as the elements of the list. An empty list is returned if cnt is 0.

+ ERL_NIF_TERMenif_make_list1(ErlNifEnv* env, ERL_NIF_TERM e1) + ERL_NIF_TERMenif_make_list2(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2) + ERL_NIF_TERMenif_make_list3(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2, ERL_NIF_TERM e3) + ERL_NIF_TERMenif_make_list4(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e4) + ERL_NIF_TERMenif_make_list5(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e5) + ERL_NIF_TERMenif_make_list6(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e6) + ERL_NIF_TERMenif_make_list7(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e7) + ERL_NIF_TERMenif_make_list8(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e8) + ERL_NIF_TERMenif_make_list9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9) + Create a list term. +

Create an ordinary list term with length indicated by the + function name. Prefere these functions (macros) over the variadic + enif_make_list to get compile time error if the number of + arguments does not match.

+
ERL_NIF_TERMenif_make_list_cell(ErlNifEnv* env, ERL_NIF_TERM head, ERL_NIF_TERM tail) Create a list cell.

Create a list cell [head | tail].

+ ERL_NIF_TERMenif_make_list_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt) + Create a list term from an array. +

Create an ordinary list containing the elements of array arr + of length cnt. An empty list is returned if cnt is 0.

+
+ ERL_NIF_TERMenif_make_long(ErlNifEnv* env, long int i) + Create an integer term from a long int +

Create an integer term from a long int.

+
ERL_NIF_TERMenif_make_ref(ErlNifEnv* env) Create a reference.

Create a reference like erlang:make_ref/0.

- ERL_NIF_TERMenif_make_string(ErlNifEnv* env, const char* string) + ERL_NIF_TERMenif_make_resource(ErlNifEnv* env, void* obj) + Create an opaque handle to a resource object +

Create an opaque handle to a memory managed resource object + obtained by enif_alloc_resource. + No ownership transfer is done, the resource object still needs to be released by + enif_release_resource.

+

Note that the only defined behaviour when using of a resource term in + an Erlang program is to store it and send it between processes on the + same node. Other operations such as matching or term_to_binary + will have unpredictable (but harmless) results.

+
+ ERL_NIF_TERMenif_make_string(ErlNifEnv* env, const char* string, ErlNifCharEncoding encoding) Create a string.

Create a list containing the characters of the - C-string string.

+ null-terminated string string with encoding encoding.

+
+ ERL_NIF_TERMenif_make_sub_binary(ErlNifEnv* + env, ERL_NIF_TERM bin_term, unsigned pos, unsigned size) + Make a subbinary term. +

Make a subbinary of binary bin_term, starting at + zero-based position pos with a length of size bytes. + bin_term must be a binary or bitstring and + pos+size must be less or equal to the number of whole + bytes in bin_term.

ERL_NIF_TERMenif_make_tuple(ErlNifEnv* env, unsigned cnt, ...) Create a tuple term. @@ -386,13 +629,205 @@ typedef struct { cnt number of arguments (after cnt) of type ERL_NIF_TERM as the elements of the tuple.

+ ERL_NIF_TERMenif_make_tuple1(ErlNifEnv* env, ERL_NIF_TERM e1) + ERL_NIF_TERMenif_make_tuple2(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2) + ERL_NIF_TERMenif_make_tuple3(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2, ERL_NIF_TERM e3) + ERL_NIF_TERMenif_make_tuple4(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e4) + ERL_NIF_TERMenif_make_tuple5(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e5) + ERL_NIF_TERMenif_make_tuple6(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e6) + ERL_NIF_TERMenif_make_tuple7(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e7) + ERL_NIF_TERMenif_make_tuple8(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e8) + ERL_NIF_TERMenif_make_tuple9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9) + Create a tuple term. +

Create a tuple term with length indicated by the + function name. Prefere these functions (macros) over the variadic + enif_make_tuple to get compile time error if the number of + arguments does not match.

+
+ ERL_NIF_TERMenif_make_tuple_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt) + Create a tuple term from an array. +

Create a tuple containing the elements of array arr + of length cnt.

+
+ ERL_NIF_TERMenif_make_uint(ErlNifEnv* env, unsigned int i) + Create an unsigned integer term +

Create an integer term from an unsigned int.

+
ERL_NIF_TERMenif_make_ulong(ErlNifEnv* env, unsigned long i) Create an integer term from an unsigned long int

Create an integer term from an unsigned long int.

+ ErlNifMutex*enif_mutex_create(char *name) + +

Same as erl_drv_mutex_create(). +

+
+ voidenif_mutex_destroy(ErlNifMutex *mtx) + +

Same as erl_drv_mutex_destroy(). +

+
+ voidenif_mutex_lock(ErlNifMutex *mtx) + +

Same as erl_drv_mutex_lock(). +

+
+ intenif_mutex_trylock(ErlNifMutex *mtx) + +

Same as erl_drv_mutex_trylock(). +

+
+ voidenif_mutex_unlock(ErlNifMutex *mtx) + +

Same as erl_drv_mutex_unlock(). +

+
+ ErlNifResourceType*enif_open_resource_type(ErlNifEnv* env, const char* name, + ErlNifResourceDtor* dtor, ErlNifResourceFlags flags, ErlNifResourceFlags* tried) + Create or takeover a resource type +

Create or takeover a resource type identified by the string + name and give it the destructor function pointed to by dtor. + Argument flags can have the following values:

+ + ERL_NIF_RT_CREATE + Create a new resource type that does not already exist. + ERL_NIF_RT_TAKEOVER + Open an existing resource type and take over ownership of all its instances. + The supplied destructor dtor will be called both for existing instances + as well as new instances not yet created by the calling NIF library. + +

The two flag values can be combined with bitwise-or. To avoid unintentionally + name clashes a good practice is to include the module name as part of the + type name. The dtor may be NULL in case no destructor + is needed.

+

On success, return a pointer to the resource type and *tried + will be set to either ERL_NIF_RT_CREATE or + ERL_NIF_RT_TAKEOVER to indicate what was actually done. + On failure, return NULL and set *tried to flags. + It is allowed to set tried to NULL.

+

Note that enif_open_resource_type is only allowed to be called in the three callbacks + load, reload + and upgrade.

+
+
+ void*enif_priv_data(ErlNifEnv* env) + Get the private data of a NIF library +

Return the pointer to the private data that was set by load, + reload or upgrade.

+

Was previously named enif_get_data.

+
voidenif_release_binary(ErlNifEnv* env, ErlNifBinary* bin) Release a binary. -

Release a binary obtained from enif_alloc_binary or enif_inspect_binary.

+

Release a binary obtained + from enif_alloc_binary.

+
+ voidenif_release_resource(ErlNifEnv* env, void* obj) + Release a resource object. +

Release a resource objects obtained from enif_alloc_resource. + The object may still be alive if it is referred to by Erlang terms. Each call to + enif_release_resource must correspond to a previous call to enif_alloc_resource. + References made by enif_make_resource can only be released by the garbage collector.

+
+ ErlNifRWLock*enif_rwlock_create(char *name) + +

Same as erl_drv_rwlock_create(). +

+
+ voidenif_rwlock_destroy(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_destroy(). +

+
+ voidenif_rwlock_rlock(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_rlock(). +

+
+ voidenif_rwlock_runlock(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_runlock(). +

+
+ voidenif_rwlock_rwlock(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_rwlock(). +

+
+ voidenif_rwlock_rwunlock(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_rwunlock(). +

+
+ intenif_rwlock_tryrlock(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_tryrlock(). +

+
+ intenif_rwlock_tryrwlock(ErlNifRWLock *rwlck) + +

Same as erl_drv_rwlock_tryrwlock(). +

+
+ unsignedenif_sizeof_resource(ErlNifEnv* env, void* obj) + Get the byte size of a resource object +

Get the byte size of a resource object obj obtained by + enif_alloc_resource.

+
+ + voidenif_system_info(ErlNifSysInfo *sys_info_ptr, size_t size) + Get information about the Erlang runtime system +

Same as driver_system_info(). +

+
+ intenif_thread_create(char *name,ErlNifTid *tid,void * (*func)(void *),void *args,ErlNifThreadOpts *opts) + +

Same as erl_drv_thread_create(). +

+
+ voidenif_thread_exit(void *resp) + +

Same as erl_drv_thread_exit(). +

+
+ intenif_thread_join(ErlNifTid, void **respp) + +

Same as erl_drv_thread_join (). +

+
+ ErlNifThreadOpts*enif_thread_opts_create(char *name) + +

Same as erl_drv_thread_opts_create(). +

+
+ voidenif_thread_opts_destroy(ErlNifThreadOpts *opts) + +

Same as erl_drv_thread_opts_destroy(). +

+
+ ErlNifTidenif_thread_self(void) + +

Same as erl_drv_thread_self(). +

+
+ intenif_tsd_key_create(char *name, ErlNifTSDKey *key) + +

Same as erl_drv_tsd_key_create(). +

+
+ voidenif_tsd_key_destroy(ErlNifTSDKey key) + +

Same as erl_drv_tsd_key_destroy(). +

+
+ void*enif_tsd_get(ErlNifTSDKey key) + +

Same as erl_drv_tsd_get(). +

+
+ voidenif_tsd_set(ErlNifTSDKey key, void *data) + +

Same as erl_drv_tsd_set(). +

-- cgit v1.2.3