]> git.saurik.com Git - apple/objc4.git/blobdiff - test/load-parallel0.m
objc4-818.2.tar.gz
[apple/objc4.git] / test / load-parallel0.m
index dc410d62c8fa810265296b7bea0728e67c14f9a4..2e135e9f32309778cdf7b1eebd02911880c02e91 100644 (file)
@@ -2,16 +2,20 @@
 #error -DN=n missing
 #endif
 
+#import <objc/objc-api.h>
 #include <stdio.h>
 #include <sched.h>
 #include <unistd.h>
-#include <libkern/OSAtomic.h>
-extern int state;
+#include "test.h"
+extern atomic_int state;
 
 #define CLASS0(n,nn)                                                    \
+    OBJC_ROOT_CLASS                                                     \
     @interface C_##n##_##nn @end                                        \
     @implementation C_##n##_##nn                                        \
-    +(void)load { OSAtomicIncrement32(&state); usleep(10); }            \
+    +(void)load {                                                       \
+        atomic_fetch_add_explicit(&state, 1, memory_order_relaxed);     \
+        usleep(10); }                                                   \
     @end
 
 #define CLASS(n,nn) CLASS0(n,nn)