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

Does channel send have the correct ordering? #51

Open
elcritch opened this issue Nov 14, 2023 · 0 comments
Open

Does channel send have the correct ordering? #51

elcritch opened this issue Nov 14, 2023 · 0 comments

Comments

@elcritch
Copy link
Contributor

Is the ordering of the GC_runOrc and wasMoved correct?

Intuitively I'd think that it'd be wasMoved then running GC_runOrc to handle cleaning up the ORC "roots" from the current thread? I'm not sure where/when the ORC cycle "roots" added or removed.

I could also be misunderstanding the intent of running GC_runOrc at this point, which I'd like to understand as well.

proc send*[T](c: Chan[T], src: sink Isolated[T]) {.inline.} =
  ## Sends item to the channel (blocking).
  var data = src.extract
  when defined(gcOrc) and defined(nimSafeOrcSend):
    GC_runOrc()
  discard channelSend(c.d, data.unsafeAddr, sizeof(T), true)
  wasMoved(data)
@elcritch elcritch changed the title Does channel send have the right ordering? Does channel send have the correct ordering? Nov 14, 2023
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

1 participant