Overview
Context
Changes
Modified configure.ac
from [30254b5fb3]
to [b6a1472c42].
︙ | | |
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
|
+
-
+
+
+
+
+
+
+
|
], [
AC_MSG_ERROR(No supported threads found!)
])
;;
esac
AC_DEFINE(OF_THREADS, 1, [Whether we have threads])
AC_SUBST(THREADING_SOURCES, " \
AC_SUBST(OFTHREAD_M, "OFThread.m")
OFThread.m \
OFThreadPool.m \
OFTLSKey.m \
OFMutex.m \
OFRecursiveMutex.m \
OFCondition.m \
")
AC_SUBST(OFTHREADTESTS_M, "OFThreadTests.m")
AC_SUBST(OFHTTPREQUESTTESTS_M, "OFHTTPRequestTests.m")
AC_SUBST(THREADING_H, "threading.h")
AC_MSG_CHECKING(whether __thread works)
AC_TRY_LINK([
/* It seems __thread is buggy with GCC 4.1 */
|
︙ | | |
Modified extra.mk.in
from [09b4d1b91a]
to [5e032b6b91].
︙ | | |
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
-
+
|
OBJC_SYNC_M = @OBJC_SYNC_M@
OFHTTPREQUESTTESTS_M = @OFHTTPREQUESTTESTS_M@
OFPLUGIN_M = @OFPLUGIN_M@
OFPLUGINTESTS_M = @OFPLUGINTESTS_M@
OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@
OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@
OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@
OFTHREAD_M = @OFTHREAD_M@
OFTHREADTESTS_M = @OFTHREADTESTS_M@
PROPERTIESTESTS_M = @PROPERTIESTESTS_M@
REEXPORT_LIBOBJC = @REEXPORT_LIBOBJC@
RUNTIME = @RUNTIME@
RUNTIME_A = @RUNTIME_A@
RUNTIME_RUNTIME_A = @RUNTIME_RUNTIME_A@
RUNTIME_RUNTIME_LIB_A = @RUNTIME_RUNTIME_LIB_A@
RUNTIME_LIB_A = @RUNTIME_LIB_A@
TESTPLUGIN = @TESTPLUGIN@
TESTS = @TESTS@
TEST_LAUNCHER = @TEST_LAUNCHER@
THREADING_H = @THREADING_H@
THREADING_SOURCES = @THREADING_SOURCES@
|
Modified src/Makefile
from [2695ae7f64]
to [7a8233cdb8].
︙ | | |
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
-
-
+
|
OFString+Hashing.m \
OFString+JSONValue.m \
OFString+Serialization.m \
OFString+URLEncoding.m \
OFString+XMLEscaping.m \
OFString+XMLUnescaping.m \
OFTCPSocket.m \
${OFTHREAD_M} \
OFThreadPool.m \
OFTimer.m \
OFURL.m \
OFXMLAttribute.m \
OFXMLCDATA.m \
OFXMLCharacters.m \
OFXMLComment.m \
OFXMLElement.m \
OFXMLElement+Serialization.m \
OFXMLElementBuilder.m \
OFXMLNode.m \
OFXMLParser.m \
OFXMLProcessingInstructions.m \
${THREADING_SOURCES} \
base64.m \
of_asprintf.m \
of_strptime.m \
unicode.m
INCLUDES := ${SRCS:.m=.h} \
OFCollection.h \
|
︙ | | |
Added src/OFCondition.h version [1e8d6909b1].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFMutex.h"
/**
* \brief A class implementing a condition variable for thread synchronization.
*/
@interface OFCondition: OFMutex
{
of_condition_t condition;
BOOL conditionInitialized;
}
/**
* \brief Creates a new condition.
*
* \return A new, autoreleased OFCondition
*/
+ (instancetype)condition;
/**
* \brief Blocks the current thread until another thread calls -[signal] or
* -[broadcast].
*/
- (void)wait;
/**
* \brief Signals the next waiting thread to continue.
*/
- (void)signal;
/**
* \brief Signals all threads to continue.
*/
- (void)broadcast;
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFCondition.m version [7c6f9d2d69].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFCondition.h"
#import "OFConditionBroadcastFailedException.h"
#import "OFConditionSignalFailedException.h"
#import "OFConditionStillWaitingException.h"
#import "OFConditionWaitFailedException.h"
#import "OFInitializationFailedException.h"
@implementation OFCondition
+ (instancetype)condition
{
return [[[self alloc] init] autorelease];
}
- init
{
self = [super init];
if (!of_condition_new(&condition)) {
Class c = [self class];
[self release];
@throw [OFInitializationFailedException exceptionWithClass: c];
}
conditionInitialized = YES;
return self;
}
- (void)wait
{
if (!of_condition_wait(&condition, &mutex))
@throw [OFConditionWaitFailedException
exceptionWithClass: [self class]
condition: self];
}
- (void)signal
{
if (!of_condition_signal(&condition))
@throw [OFConditionSignalFailedException
exceptionWithClass: [self class]
condition: self];
}
- (void)broadcast
{
if (!of_condition_broadcast(&condition))
@throw [OFConditionBroadcastFailedException
exceptionWithClass: [self class]
condition: self];
}
- (void)dealloc
{
if (conditionInitialized)
if (!of_condition_free(&condition))
@throw [OFConditionStillWaitingException
exceptionWithClass: [self class]
condition: self];
[super dealloc];
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFMutex.h version [a9c6524320].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFObject.h"
#import "threading.h"
/**
* \brief A class for creating mutual exclusions.
*/
@interface OFMutex: OFObject
{
of_mutex_t mutex;
BOOL initialized;
}
/**
* \brief Creates a new mutex.
*
* \return A new autoreleased mutex.
*/
+ (instancetype)mutex;
- OF_initWithoutCreatingMutex;
/**
* \brief Locks the mutex.
*/
- (void)lock;
/**
* \brief Tries to lock the mutex.
*
* \return A boolean whether the mutex could be acquired
*/
- (BOOL)tryLock;
/**
* \brief Unlocks the mutex.
*/
- (void)unlock;
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFMutex.m version [3c3018edf4].