X-Git-Url: https://git.saurik.com/apple/objc4.git/blobdiff_plain/7c0e6487d7b67b6bf6c632300ee4b74e8950b051..7af964d1562d70f51a8e9aca24215ac3d83d0624:/test/load-reentrant2.m diff --git a/test/load-reentrant2.m b/test/load-reentrant2.m new file mode 100644 index 0000000..78d897f --- /dev/null +++ b/test/load-reentrant2.m @@ -0,0 +1,22 @@ +#include "test.h" + +int state2 = 0; +extern int state1; + +static void ctor(void) __attribute__((constructor)); +static void ctor(void) +{ + // should be called during One's dlopen(), before Two's +load + testassert(state1 == 111); + testassert(state2 == 0); +} + +@interface Two @end +@implementation Two ++(void) load +{ + // Does not run until One's +load completes + testassert(state1 == 1); + state2 = 2; +} +@end