Added a main() to atomic.c

This commit is contained in:
Nils O. Selåsdal
2015-01-03 02:10:51 +01:00
parent 603d86bb61
commit f0c829a6c9
+19
View File
@@ -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;
}