Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -190,20 +190,20 @@ case "$host" in *-*-mingw*) AC_PATH_PROG(WINE, wine) if test x"$WINE" != "x"; then - AC_SUBST(TESTS, "tests_new tests") + AC_SUBST(TESTS, "tests_new") AC_SUBST(TEST_LAUNCHER, "$WINE") fi ;; esac else - AC_SUBST(TESTS, "tests_new tests") + AC_SUBST(TESTS, "tests_new") fi BUILDSYS_TOUCH_DEPS AC_SUBST(PACKAGE, objfw) AC_CONFIG_FILES([buildsys.mk extra.mk objfw-config]) AC_CONFIG_HEADERS(config.h) AC_OUTPUT DELETED tests/Makefile Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -1,5 +0,0 @@ -include ../extra.mk - -SUBDIRS = ${OBJC_SYNC} - -include ../buildsys.mk DELETED tests/objc_sync/Makefile Index: tests/objc_sync/Makefile ================================================================== --- tests/objc_sync/Makefile +++ tests/objc_sync/Makefile @@ -1,29 +0,0 @@ -PROG_NOINST = objc_sync${PROG_SUFFIX} -SRCS = objc_sync.m - -include ../../buildsys.mk -include ../../extra.mk - -CPPFLAGS += -I../../src -I../.. -LIBS := -L../../src -lobjfw ${LIBS} - -.PHONY: run - -all: run -run: ${PROG_NOINST} - rm -f libobjfw.so.0 libobjfw.so.0.1 libobjfw.dll libobjfw.dylib - if test -f ../../src/libobjfw.so; then \ - ln -s ../../src/libobjfw.so libobjfw.so.0; \ - ln -s ../../src/libobjfw.so libobjfw.so.0.1; \ - fi - if test -f ../../src/libobjfw.dll; then \ - ln ../../src/libobjfw.dll libobjfw.dll; \ - fi - if test -f ../../src/libobjfw.dylib; then \ - ln -s ../../src/libobjfw.dylib libobjfw.dylib; \ - fi - LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ - DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ - ${TEST_LAUNCHER} ./${PROG_NOINST}; EXIT=$$?; \ - rm -f libobjfw.so.0 libobjfw.so.0.1 libobjfw.dll libobjfw.dylib; \ - exit $$EXIT DELETED tests/objc_sync/objc_sync.m Index: tests/objc_sync/objc_sync.m ================================================================== --- tests/objc_sync/objc_sync.m +++ tests/objc_sync/objc_sync.m @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2008 - 2009 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of libobjfw. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE included in - * the packaging of this file. - */ - -#include "config.h" - -#include - -#import "OFString.h" -#import "OFThread.h" - -OFObject *lock; - -@interface MyThread: OFThread -- main; -@end - -@implementation MyThread -- main -{ - printf("[%s] Entering #1\n", [object cString]); - @synchronized (lock) { - printf("[%s] Entering #2\n", [object cString]); - @synchronized (lock) { - printf("[%s] Hello!\n", [object cString]); - } - printf("[%s] Left #2\n", [object cString]); - } - printf("[%s] Left #1\n", [object cString]); - - return nil; -} -@end - -int -main() -{ - lock = [[OFObject alloc] init]; - MyThread *t1 = [MyThread threadWithObject: @"A"]; - MyThread *t2 = [MyThread threadWithObject: @"B"]; - - [t1 join]; - [t2 join]; - - return 0; -} ADDED tests_new/objc_sync/Makefile Index: tests_new/objc_sync/Makefile ================================================================== --- tests_new/objc_sync/Makefile +++ tests_new/objc_sync/Makefile @@ -0,0 +1,26 @@ +PROG_NOINST = objc_sync${PROG_SUFFIX} +SRCS = test.m + +.PHONY: run +run: all + rm -f libobjfw.so.0 libobjfw.so.0.1 libobjfw.dll libobjfw.dylib + if test -f ../../src/libobjfw.so; then \ + ln -s ../../src/libobjfw.so libobjfw.so.0; \ + ln -s ../../src/libobjfw.so libobjfw.so.0.1; \ + fi + if test -f ../../src/libobjfw.dll; then \ + ln ../../src/libobjfw.dll libobjfw.dll; \ + fi + if test -f ../../src/libobjfw.dylib; then \ + ln -s ../../src/libobjfw.dylib libobjfw.dylib; \ + fi + LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ + DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ + ${TEST_LAUNCHER} ./${PROG_NOINST}; EXIT=$$?; \ + rm -f libobjfw.so.0 libobjfw.so.0.1 libobjfw.dll libobjfw.dylib; \ + exit $$EXIT + +include ../../buildsys.mk + +CPPFLAGS += -I../../src -I../.. +LIBS := -L../../src -lobjfw ${LIBS} ADDED tests_new/objc_sync/test.m Index: tests_new/objc_sync/test.m ================================================================== --- tests_new/objc_sync/test.m +++ tests_new/objc_sync/test.m @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2008 - 2009 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of libobjfw. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE included in + * the packaging of this file. + */ + +#include "config.h" + +#include + +#import "OFString.h" +#import "OFThread.h" + +OFObject *lock; + +@interface MyThread: OFThread +- main; +@end + +@implementation MyThread +- main +{ + printf("[%s] Entering #1\n", [object cString]); + @synchronized (lock) { + printf("[%s] Entering #2\n", [object cString]); + @synchronized (lock) { + printf("[%s] Hello!\n", [object cString]); + } + printf("[%s] Left #2\n", [object cString]); + } + printf("[%s] Left #1\n", [object cString]); + + return nil; +} +@end + +int +main() +{ + lock = [[OFObject alloc] init]; + MyThread *t1 = [MyThread threadWithObject: @"A"]; + MyThread *t2 = [MyThread threadWithObject: @"B"]; + + [t1 join]; + [t2 join]; + + return 0; +}