In my use case I wanted to open a file based mmap in a dedicated IO thread and then send it over to another thread when the mapping was complete. I am unable to think of any reason why Send and Sync wouldn't be allowed for Mmap.
My guess is that it's simply an oversight and the compiler's autotrait is wrong due to the raw pointer ptr only referring to a memory location accessible process wide which the compiler does not know. If that is the case unsafe impls should be added for Send and Sync in each of the os_impls.
I'll create a PR for this in case you want to merge it.
In my use case I wanted to open a file based mmap in a dedicated IO thread and then send it over to another thread when the mapping was complete. I am unable to think of any reason why
Send
andSync
wouldn't be allowed forMmap
.My guess is that it's simply an oversight and the compiler's autotrait is wrong due to the raw pointer
ptr
only referring to a memory location accessible process wide which the compiler does not know. If that is the caseunsafe impl
s should be added forSend
andSync
in each of theos_impl
s.I'll create a PR for this in case you want to merge it.