Skip to content

Does channel send have the correct ordering?  #51

Description

@elcritch

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions