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

Include omission from previous PR #76

Merged
merged 2 commits into from
Aug 26, 2024
Merged

Include omission from previous PR #76

merged 2 commits into from
Aug 26, 2024

Conversation

planetis-m
Copy link
Contributor

I accidentally missed the following change from my previous PR:

recvIso is also made to use Isolated[T] directly as this fixes receiving ref objects.

Meaning this now compiles:

type
  Foo = ref object
    data: int

var chan = newChan[Foo]()

block example_blocking:
  # This proc will be run in another thread.
  proc basicWorker() =
    chan.send(Foo(data: 4))

  # Launch the worker.
  var worker: Thread[void]
  createThread(worker, basicWorker)

  # Block until the message arrives, then print it out.
  var dest: Isolated[Foo]
  dest = chan.recvIso()
  echo dest.extract().data

  # Wait for the thread to exit before moving on to the next example.
  worker.joinThread()

@Araq Araq merged commit aa7ae52 into nim-lang:master Aug 26, 2024
12 checks passed
@planetis-m planetis-m deleted the chan branch August 27, 2024 06:01
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