paritytech / jsonrpc

Rust JSON-RPC implementation
MIT License
791 stars 274 forks source link

Fine-tune the Ordering for the atomic usages #684

Open wang384670111 opened 10 months ago

wang384670111 commented 10 months ago

SeqCst is overly restrictive. I believe that the ordering can be appropriately modified. I think that active is merely signal for multithreading purposes and do not synchronize with other locals. Therefore, using Relaxed ordering should suffice. https://github.com/paritytech/jsonrpc/blob/dc9550b4b0d8bf409d025eba7e9b229b67af9401/ws/src/metadata.rs#L29 https://github.com/paritytech/jsonrpc/blob/dc9550b4b0d8bf409d025eba7e9b229b67af9401/ws/src/session.rs#L166 https://github.com/paritytech/jsonrpc/blob/dc9550b4b0d8bf409d025eba7e9b229b67af9401/ws/src/session.rs#L277-L291