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

Fall back to real thread IDs when missing DetThreadId #33

Open
gatoWololo opened this issue Apr 2, 2020 · 1 comment
Open

Fall back to real thread IDs when missing DetThreadId #33

gatoWololo opened this issue Apr 2, 2020 · 1 comment

Comments

@gatoWololo
Copy link
Owner

gatoWololo commented Apr 2, 2020

Our channels work send (Option, T) where T is the actual data and Option is a unique determininistic identifier for the data. We use an option as some threads may be spawned outside our spawn wrapper in some other crate (e.g. Rayon or Tokio spawns a thread). So these threads are assigned a DeThreadId of None. This means all information about the sender thread is lost. It would be useful for us to instead use a type like:

enum ThreadInfo {
  DetThreadId(DetThreadId),
  RealThreadId(RealThreadId),
}

In the case where threads are spawned outside our std::thread::spawn wrapper this would allow us to differentiate between:

  • A real race: Which would look like two different ThreadInfo::ReadThreadId(id1) and ThreadInfo::ReadThreadId(id2)
  • A non race: Messages coming all coming from the same ThreadInfo::ReadThreadId(id).
@gatoWololo
Copy link
Owner Author

We might want to take this one step further and consider any thread sending channel messages from an "initialized thread" (one without a DetThreadId) to be a bug. This would simplify the cases we have to handle and would keep our deterministic gurantee straightforward.

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