]> git.saurik.com Git - apple/objc4.git/blob - test/load-parallel0.m
9f3a3e1f67148939a43bf9273289d1d6052c0bf5
[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 <libkern/OSAtomic.h>
10 extern 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 { OSAtomicIncrement32(&state); usleep(10); } \
17 @end
18
19 #define CLASS(n,nn) CLASS0(n,nn)
20
21 CLASS(a,N)
22 CLASS(b,N)
23 CLASS(c,N)
24 CLASS(d,N)
25 CLASS(e,N)
26 CLASS(f,N)
27 CLASS(g,N)
28 CLASS(h,N)
29 CLASS(i,N)
30 CLASS(j,N)
31 CLASS(k,N)
32 CLASS(l,N)
33 CLASS(m,N)
34 CLASS(n,N)
35 CLASS(o,N)
36 CLASS(p,N)
37 CLASS(q,N)
38 CLASS(r,N)
39 CLASS(s,N)
40 CLASS(t,N)
41 CLASS(u,N)
42 CLASS(v,N)
43 CLASS(w,N)
44 CLASS(x,N)
45 CLASS(y,N)
46 CLASS(z,N)