mirror of
https://github.com/actix/actix-web.git
synced 2024-12-21 07:36:43 +00:00
Use AtomicUsize properly
doing a read+write on an atomic int will lose updates from other threads.
This commit is contained in:
parent
335ca8ff33
commit
57655d8153
1 changed files with 1 additions and 2 deletions
|
@ -89,8 +89,7 @@ impl<S> Handler<S> for MyHandler {
|
|||
|
||||
/// Handle request
|
||||
fn handle(&mut self, req: HttpRequest<S>) -> Self::Result {
|
||||
let num = self.0.load(Ordering::Relaxed) + 1;
|
||||
self.0.store(num, Ordering::Relaxed);
|
||||
self.0.fetch_add(1, Ordering::Relaxed);
|
||||
httpcodes::HTTPOk.into()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue