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 wildcard matching in resource counters #128

Merged
merged 4 commits into from
Sep 18, 2020
Merged

Add wildcard matching in resource counters #128

merged 4 commits into from
Sep 18, 2020

Conversation

uwiger
Copy link
Owner

@uwiger uwiger commented Nov 30, 2016

From the edoc

  • rc - 'resource counter', tracks the number of resource properties
    with the same name. When the resource count reaches 0, any triggers
    specified using an on_zero attribute may be executed (see below).
    If Name is a tuple, the last element of the name can contain a
    wildcard, using the symbol '\\_'. This will make the resource
    counter keep track of any resources where all elements match except
    the last position. For example, {rc,l,{a,b,'\\_'}} would keep
    track of both {r,l,{a,b,1}} and {r,l,{a,b,2}}.

If 'r' objects have a name with a '\\_' in the last element, things
go badly, so we disallow this. This led to key pattern checks in all
functions that effect registrations. Also ensure that `mreg/2' does
this.
src/gproc.erl Outdated Show resolved Hide resolved
src/gproc.erl Outdated
@@ -1211,10 +1220,11 @@ reg_shared1(_, _, _) ->
mreg(T, C, KVL) ->
?CATCH_GPROC_ERROR(mreg1(T, C, KVL), [T, C, KVL]).

%% TODO: We don't call valid_key/1 here, since
Copy link
Collaborator

Choose a reason for hiding this comment

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

why?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Sorry, a remnant from earlier.

src/gproc_lib.erl Outdated Show resolved Hide resolved
src/gproc.erl Outdated Show resolved Hide resolved
Co-authored-by: Tino Breddin <tolbrino@users.noreply.github.com>
@uwiger uwiger requested a review from tolbrino September 17, 2020 13:09
@uwiger uwiger merged commit 378bd27 into master Sep 18, 2020
@uwiger uwiger deleted the uw-wild-rc branch September 18, 2020 07:12
@tolbrino
Copy link
Collaborator

LGTM

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.

2 participants