Skip to content

Instantly share code, notes, and snippets.

@pzol
Created January 30, 2014 13:23
Show Gist options
  • Save pzol/8708193 to your computer and use it in GitHub Desktop.
Save pzol/8708193 to your computer and use it in GitHub Desktop.
use std::sync::atomics::{ AtomicUint, INIT_ATOMIC_UINT, Ordering, AcqRel };
static counter: AtomicUint = INIT_ATOMIC_UINT;
fn call() -> uint {
let current = counter.fetch_add(1, AcqRel);
current.clone()
}
@pzol
Copy link
Author

pzol commented Jan 30, 2014

/Users/pzol/Dropbox/src/rust/one/src/varnish/test.rs:6:17: 6:24 error: cannot borrow immutable static item as mutable
/Users/pzol/Dropbox/src/rust/one/src/varnish/test.rs:6 let current = counter.fetch_add(1, AcqRel);
^~~~~~~
error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment