]> git.saurik.com Git - apple/objc4.git/blob - test/load-parallel0.m
objc4-818.2.tar.gz
[apple/objc4.git] / test / load-parallel0.m
1 #ifndef N
2 #error -DN=n missing
3 #endif
4
5 #import <objc/objc-api.h>
6 #include <stdio.h>
7 #include <sched.h>
8 #include <unistd.h>
9 #include "test.h"
10 extern atomic_int state;
11
12 #define CLASS0(n,nn) \
13 OBJC_ROOT_CLASS \
14 @interface C_##n##_##nn @end \
15 @implementation C_##n##_##nn \
16 +(void)load { \
17 atomic_fetch_add_explicit(&state, 1, memory_order_relaxed); \
18 usleep(10); } \
19 @end
20
21 #define CLASS(n,nn) CLASS0(n,nn)
22
23 CLASS(a,N)
24 CLASS(b,N)
25 CLASS(c,N)
26 CLASS(d,N)
27 CLASS(e,N)
28 CLASS(f,N)
29 CLASS(g,N)
30 CLASS(h,N)
31 CLASS(i,N)
32 CLASS(j,N)
33 CLASS(k,N)
34 CLASS(l,N)
35 CLASS(m,N)
36 CLASS(n,N)
37 CLASS(o,N)
38 CLASS(p,N)
39 CLASS(q,N)
40 CLASS(r,N)
41 CLASS(s,N)
42 CLASS(t,N)
43 CLASS(u,N)
44 CLASS(v,N)
45 CLASS(w,N)
46 CLASS(x,N)
47 CLASS(y,N)
48 CLASS(z,N)