Hi, I have a library containing a data-structure, you can think of it as an in-memory database. This data-structure can be safely accessed from multiple threads and I require all types stored to be
Send + Sync. Each stored type has it's own
Vec-like storage. To make any operation, you first request the storage and then can access data through a guard.
Recently I had an idea to allow
!Sync types but I'm not 100% it's correct.
Send + !Sync-> shared and unique access in one thread at a time
!Send + Sync-> shared access only
Send + !Sync-> shared and unique access in the thread it was added in
- The data-structure have to loose
The guard would have the same bound as the storage.
Are these guaranties enough?
Thank you for your time
EDIT: mutable access is also ok for
Send + !Sync
!Send + Sync case