File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ pub use validation::ValidationFlagsType;
3838pub struct Session {
3939 handle : CK_SESSION_HANDLE ,
4040 client : Pkcs11 ,
41- // This is not used but to prevent Session to automatically implement Send and Sync
41+ // This is not used but to prevent Session to automatically implement Sync
4242 _guard : PhantomData < * mut u32 > ,
4343}
4444
@@ -60,6 +60,10 @@ impl std::fmt::UpperHex for Session {
6060 }
6161}
6262
63+ // Session does not implement Sync to prevent the same Session instance to be used from multiple
64+ // threads. Send is allowed to let users pass a Session by ownership to threads.
65+ unsafe impl Send for Session { }
66+
6367impl Session {
6468 pub ( crate ) fn new ( handle : CK_SESSION_HANDLE , client : Pkcs11 ) -> Self {
6569 Session {
You can’t perform that action at this time.
0 commit comments