Pārlūkot izejas kodu

- updated the ser lib using modules to the new lib building system
(libs are built automatically if needed by a module and when a module that uses a ser lib is installed it will be re-linked with the correct rpath => no more
LD_LIBRARY_PATH)

Andrei Pelinescu-Onciul 18 gadi atpakaļ
vecāks
revīzija
1587fbf008
2 mainītis faili ar 11 papildinājumiem un 2 dzēšanām
  1. 1 1
      Makefile
  2. 10 1
      test/atomic_test2.c

+ 1 - 1
Makefile

@@ -141,7 +141,7 @@ else
 							auth_radius group_radius uri_radius avp_radius \
 							acc_radius dialog pa rls presence_b2b xcap xmlrpc\
 							osp tls oracle \
-							unixsock eval dbg print_lib
+							unixsock eval dbg print_lib auth_identity
 endif
 
 # always exclude the CVS dir

+ 10 - 1
test/atomic_test2.c

@@ -133,6 +133,7 @@ static char* flags=
 #define at_and	AT_DECL(and)
 #define at_or	AT_DECL(or)
 #define at_get_and_set	AT_DECL(get_and_set)
+#define at_cmpxchg	AT_DECL(cmpxchg)
 
 
 #define CHECK_ERR(txt, x, y) \
@@ -214,9 +215,17 @@ int main(int argc, char** argv)
 	printf(" atomic_and, v should be 2 ............. %2d\n", (int)at_get(v));
 	
 	VERIFY(at_or(v, 5), 7);
-	VERIFY(r=at_get_and_set(v, 0), 0);
 	printf(" atomic_or,  v should be 7 ............. %2d\n", (int)r);
+	VERIFY(r=at_get_and_set(v, 0), 0);
 	printf(" atomic_get_and_set, v should be 0 ..... %2d\n", (int)at_get(v));
+	VERIFY(r=at_cmpxchg(v, 0, 7), 7);
+	CHECK_ERR(cmpxchg, r, 0);
+	printf(" atomic_cmpxchg, v should be 7 ......... %2d\n", (int)at_get(v));
+	printf("                 r should be 0 ......... %2d\n", (int)r);
+	VERIFY(r=at_cmpxchg(v, 2, 3), 7);
+	CHECK_ERR(cmpxchg, r, 7);
+	printf(" atomic_cmpxchg (fail), v should be 7 .. %2d\n", (int)at_get(v));
+	printf("                        r should be 7 .. %2d\n", (int)r);
 
 	
 	printf("\ndone.\n");