Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unregister/1 #364

Closed
wants to merge 6 commits into from

Conversation

UncleGrumpy
Copy link
Collaborator

These changes add unregister/1 as well as some minor enhancements to error returns to match expected otp behavior, and address the TODOs in the nif_erlang_register_2 function in src/libAtomVM.nifs.c. Also adds test for register/2 and unregister/1 return values, functionality, and error returns - designed to test the conditions raised in the previously addressed TODOs (existing process pid, not already registered, not the atom "undefined").

Closes issue #358

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

src/libAtomVM/globalcontext.c Show resolved Hide resolved
tests/erlang_tests/register_unregister.erl Outdated Show resolved Hide resolved
src/libAtomVM/nifs.c Outdated Show resolved Hide resolved
src/libAtomVM/nifs.c Outdated Show resolved Hide resolved
src/libAtomVM/nifs.c Show resolved Hide resolved
src/libAtomVM/nifs.c Show resolved Hide resolved
src/libAtomVM/nifs.c Show resolved Hide resolved
src/libAtomVM/globalcontext.c Show resolved Hide resolved
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's cleanup history before merging.

@UncleGrumpy UncleGrumpy force-pushed the unregister branch 6 times, most recently from 733a4ec to cdb26de Compare October 20, 2022 19:38
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR git history is not clean yet, let's get in touch and work together on this :)

@UncleGrumpy UncleGrumpy force-pushed the unregister branch 8 times, most recently from ca6fff6 to 3da3a81 Compare October 22, 2022 23:37
Winford added 6 commits October 22, 2022 16:38
Signed-off-by: Winford <dwinford@pm.me>
Signed-off-by: Winford <dwinford@pm.me>
Adds checks that pid is an active process, atom is not already registered to a
process, and the atom name is not the "undefined" atom.

Signed-off-by: Winford <dwinford@pm.me>
Closes issue atomvm#358.

Signed-off-by: Winford <dwinford@pm.me>
`register/2` and `unregister/1` functions are tested for correct returns,
functionality, and proper error returns.

Signed-off-by: Winford <dwinford@pm.me>
Exposes a native elixir interface to unregister/1.

Signed-off-by: Winford <dwinford@pm.me>
@bettio bettio changed the title Adds support for unregister/1 Add support for unregister/1 Oct 23, 2022
bettio added a commit that referenced this pull request Oct 23, 2022
Add support for `unregister/1`

These changes add `unregister/1` as well as some minor enhancements to error
returns to match expected otp behavior, and address the TODOs in the
`nif_erlang_register_2` function in src/libAtomVM.nifs.c. Also adds test for
`register/2` and `unregister/1` return values, functionality, and error returns
- designed to test the conditions raised in the previously addressed TODOs
(existing process pid, not already registered, not the atom "undefined").

Closes issue #358

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
@bettio
Copy link
Collaborator

bettio commented Oct 23, 2022

Merged with some minor git history and CHANGELOG cleanups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants