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

Question with safety of the function call_linksafe #5

Open
suexcxine opened this issue Apr 3, 2020 · 1 comment
Open

Question with safety of the function call_linksafe #5

suexcxine opened this issue Apr 3, 2020 · 1 comment

Comments

@suexcxine
Copy link

  def call_linksafe(name, max, func) do
    if acquire(name, max) do
      safe_key = {name, self()}
      inserted = ETS.insert_new(@call_safe_table, [safe_key])

What if the process killed before ETS.insert_new(@call_safe_table, [safe_key]) ?
Seems like we still have problem, although time window for this is rather small.

@saleyn
Copy link

saleyn commented Dec 24, 2022

It doesn't look like the current implementation is correct in this regard as it doesn't guarantee the atomicity of acquiring the lock and saving the pid of the caller that acquired the lock.

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

No branches or pull requests

2 participants