Skip to content

Instantly share code, notes, and snippets.

@TrigDevelopment
Created March 22, 2021 10:36
Show Gist options
  • Select an option

  • Save TrigDevelopment/2057188c594aa9c5ed87a475ed1baf15 to your computer and use it in GitHub Desktop.

Select an option

Save TrigDevelopment/2057188c594aa9c5ed87a475ed1baf15 to your computer and use it in GitHub Desktop.
typedef struct {
int counter;
} atomic_t;
/*@ ensures v.counter == \old(v.counter) + 1;
*/
static inline void atomic_inc(atomic_t v);
/*@ assigns \nothing;
ensures 1 == 0;
*/
void f() {
atomic_t some_atomic;
atomic_inc(some_atomic);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment