Skip to content

Changing managed thread associated with "main" realm context #2649

Answered by nirinchev
peppy asked this question in Q&A
Discussion options

You must be logged in to vote

The way I see it, you have two options:

  1. Close and reopen the Realm instance when the user switches to-and-from multithreaded execution. The new realm instance will be associated with the new thread, so you'll be able to access it normally.
  2. Create a synchronization context and install it on your threads. It will then take precedence over the thread id in that IsOnContext check. There are two considerations when rolling that out:
    2.1. It may affect where your async continuations are dispatched. You will probably want to do something clever and capture the original thread to make sure you dispatch continuations from the draw thread back to the draw thread.
    2.2. You need to ensure no paralle…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@nirinchev
Comment options

@peppy
Comment options

@nirinchev
Comment options

@nirinchev
Comment options

@peppy
Comment options

Answer selected by peppy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants