aboutsummaryrefslogtreecommitdiffstats
path: root/erts/doc/src/erl_nif.xml
AgeCommit message (Collapse)Author
2018-02-23erts: Clarify enif_self docsSverker Eriksson
2017-11-23Document alignment guarantees of enif_alloc and enif_reallocAnthony Ramine
2017-11-21Document enif_reallocAnthony Ramine
2017-09-07Merge branch 'sverker/nif-resource-doc' into maintSverker Eriksson
* sverker/nif-resource-doc: erts: Update docs for enif_make_resource
2017-09-05erts: Update docs for enif_make_resourceSverker Eriksson
to include new defined properties in OTP-20 regarding comparison and serialization.
2017-09-05erts: Add nif ioqLukas Larsson
2017-05-22Add enif_whereis_...() functionsTed Burghart
#### Why do we need this new feature? There are cases when a NIF needs to send a message, using `enif_send()`, to a long-lived process with a registered name. A common use-case is logging, where asynchronous fire-and-forget messages are the norm. There can also be cases where a yielding or dirty NIF or background thread may request a callback from a service with additional information it needs to complete its operation, yielding or waiting (with suitable timeouts, etc) until its state has been updated through the NIF module's API. NIFs can only send messages to pids, and the lack of name resolution leaves a complicated dance between separate monitoring processes and the NIF as the only way to keep a NIF informed of the whereabouts of such long-lived processes. Providing a reliable, built-in facility for NIFs to resolve process (or port) names simplifies these use cases considerably. #### Risks or uncertain artifacts? Testing has not exposed any significant risk. The implementation behaves as expected on regular and dirty scheduler threads as well as non-scheduler threads. By constraining the `enif_whereis_...()` functions to their minimal scopes and using patterns consistent with related functions, the implementation, testing, and maintenance burden is low. The API and behavior of existing functions is unchanged. #### How did you solve it? While extending `enif_send()` to operate on a pid or an atom (as `erlang:send/2` does) was attractive, it would have entailed changing the type of its `to_pid` parameter and thereby breaking backward compatibility. The same consideration applies to `enif_port_command()`. That leaves a choice between 1, 2, or 3 new functions: 1. `enif_whereis()` 2. `enif_whereis_pid()` and `enif_whereis_port()` 3. All of the above. While option (1), directly mimicking the behavior of `erlang:whereis/1`, is appealing, it poses potential problems if `pid()` or `port()` are subsequently implemented as non-integral types that must be bound to an owning `ErlNifEnv` instance. Therefore, option (2) has been chosen to use `ErlNifPid`/`ErlNifPort` structures in the API to maintain proper term ownership semantics.
2017-05-10erts: Improve erl_nif docsSverker Eriksson
2017-05-04Update copyright yearRaimo Niskanen
2017-04-24erts: Discontinue salted use of enif_hash/phash2Guilherme Andrade
2017-04-22erts: Allow for easier future enif_hash expansionGuilherme Andrade
Allow for expanding support to 64-bit hashes without breaking the interface.
2017-04-22erts: Improve enif_hash documentationGuilherme Andrade
2017-04-22erts: Support custom salt in enif_hashGuilherme Andrade
2017-04-20erts: Refactor enif_phash2 into enif_hashGuilherme Andrade
A more generic hashing function which can also hash terms based on `make_internal_hash'.
2017-04-20erts: Remove enif_phash2_rangedGuilherme Andrade
2017-04-19erts: Add enif_phash2 and enif_phash2_rangedGuilherme Andrade
These allow one to hash VM terms from NIF code.
2017-03-07erts: Fix xml lint warning for erl_nifSverker Eriksson
2017-02-22Add docs for enif_compare_monitors and ErlNifMonitorSverker Eriksson
2017-02-20Fix erl_nif docSverker Eriksson
2017-02-20Merge branch 'master' into sverker/enif_selectSverker Eriksson
Conflicts: erts/emulator/beam/erl_binary.h erts/emulator/beam/erl_monitors.c erts/emulator/beam/erl_nif.c erts/emulator/beam/global.h erts/emulator/test/nif_SUITE_data/nif_SUITE.c
2017-02-09erts: Change return value for enif_selectSverker Eriksson
to negative int as error and positive as success.
2017-02-09erts: Add pid argument to enif_selectSverker Eriksson
2017-02-09erts: Add enif_monitor_process and enif_demonitor_processSverker Eriksson
2017-02-03Merge branch 'master' into sverker/enif_selectSverker Eriksson
2017-01-18Change exception for enif_schedule_nif() with dirty flagsRickard Green
2017-01-17Remove experimental disclaimer on dirty schedulersRickard Green
2016-12-19Add ErlNifSelectReturnSverker Eriksson
2016-12-19Add stop arguments: fd and is_direct_callSverker Eriksson
2016-12-19erts: Add some improvements to erl_nif docsSverker Eriksson
2016-11-30erts: Add enif_select & enif_open_resource_type_xSverker Eriksson
2016-09-23Merge branch 'sverker/remove-nif-reload/OTP-13908'Sverker Eriksson
* sverker/remove-nif-reload: erts: Cuddle nif_SUITE:consume_timeslice erts: Remove old doc note for erlang:load_nif erts: Remove deprecated nif 'reload' feature erts: Fix trace_nif_SUITE to load nif lib only once
2016-09-19Use more correct delimiters for erl_nif.h includeTuncer Ayaz
Anywhere but the beam sources we shouldn't #include "erl_nif.h", because what "erl_nif.h" does is: (1) fail to find it outside of -I dirs, (2) then treat it as if it was written like <erl_nif.h>. Using <erl_nif.h> skips (1). More information can be found in 6.10.2 of the C standard. Because the examples use "erl_nif.h", NIF projects in the Erlang ecosystem copy this verbatim and make the same mistake.
2016-09-19erts: Remove deprecated nif 'reload' featureSverker Eriksson
and instead let erlang:load_nif/2 return {error, {reload, _}} before even trying to load the library if a NIF library has already been successfully loaded for the calling module instance.
2016-09-01doc: Correct errors introduced by Editorial changesHans Bolinder
Fix some older errors as well.
2016-08-29Merge branch 'rickard/ds-purge-module/OTP-13808' into maintRickard Green
* rickard/ds-purge-module/OTP-13808: Perform check_process_code while process is executing dirty Conflicts: erts/doc/src/erl_nif.xml
2016-08-29Perform check_process_code while process is executing dirtyRickard Green
2016-07-13erts: Review of documentation changesLukas Larsson
2016-07-13erts: Editorial changesxsipewe
2016-07-13erts: Move all functions in docs to be in alphabetical orderLukas Larsson
This commit only changes the order of functions and does some other rearrangements to that the diff with the next commit will be easier to follow. No content or XML tags are changed.
2016-06-17Minor reorganization of dirty NIF documentationRickard Green
2016-06-16Add documentation about dirty job typeRickard Green
2016-06-14erts: Fix doc xml errorsLukas Larsson
2016-06-09erts: Fix erl_nif.xml xmllint errorsBjörn-Egil Dahlberg
2016-06-08Replace enif_is_on_dirty_scheduler() with enif_thread_type()Rickard Green
2016-05-31Merge branch 'rickard/ds-doc/OTP-13123'Rickard Green
* rickard/ds-doc/OTP-13123: minor fixes
2016-05-27Minor doc fixRickard Green
2016-05-23minor fixesRickard Green
2016-05-13Merge branch 'egil/erts/nif-format_term/OTP-13580'Björn-Egil Dahlberg
* egil/erts/nif-format_term/OTP-13580: runtime_tools: Change erts_snprintf to enif_snprintf erts: Document enif_snprintf erts: Add tests for enif_snprintf erts: Add enif_snprintf Conflicts: erts/emulator/beam/erl_nif_api_funcs.h
2016-05-11erts: Document enif_snprintfBjörn-Egil Dahlberg
2016-05-11Add better support for communication with a process executing dirty NIFRickard Green
- Termination of a process... - Modify trace flags of process... - Process info on process... - Register/unregister of name on process... - Set group leader on process... ... while it is executing a dirty NIF.