Added a main() to atomic.c
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ucore/atomic.h"
|
||||
UC_ATOMIC(unsigned int) i;
|
||||
|
||||
@@ -48,3 +50,20 @@ unsigned int get_i_compbar()
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("i: %u\n", get_i());
|
||||
inc_i();
|
||||
printf("i: %u\n", get_i());
|
||||
inc_i();
|
||||
dec_i();
|
||||
printf("i: %u\n", get_i());
|
||||
add_i(100);
|
||||
printf("i: %u\n", get_i());
|
||||
sub_i(50);
|
||||
printf("i: %u\n", get_i_membar());
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user