Skip to content

Fix Send and Sync bounds for M to avoiding unsound behavior. #100

@ram-nad

Description

@ram-nad

Hi,

Not sure if this is right place to ask question, please excuse me if I am at wrong place. I am relatively new to Rust and am trying to understand some intricacies of the language.

I was reading through the code and am curious if we need the following,

unsafe impl<M: Send + Sync> Sync for Runnable<M> {}

Why can't it just be

unsafe impl<M: Sync> Sync for Runnable<M> {}

As per my understanding, even if M is not Send, the Task and Runnable can still be safely shared across threads because there is no way to get exclusive access of metadata through their reference.

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