Overview
Comment: | Add -[OFCondition waitForTimeInterval:]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8d7f5db97eda50e66cdfb64b8fec53a4 |
User & Date: | js on 2013-04-30 22:36:36 |
Other Links: | manifest | tags |
Context
2013-04-30
| ||
22:47 | observeWithTimeout: -> observeForTimeInterval:. check-in: ab9ad6e515 user: js tags: trunk | |
22:36 | Add -[OFCondition waitForTimeInterval:]. check-in: 8d7f5db97e user: js tags: trunk | |
22:29 | threading.h: Add of_condition_timed_wait(). check-in: e139086f33 user: js tags: trunk | |
Changes
Modified src/OFCondition.h from [0374131e0b] to [8f1282cf3c].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * 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; | > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * 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" @class OFDate; /*! * @brief A class implementing a condition variable for thread synchronization. */ @interface OFCondition: OFMutex { of_condition_t _condition; bool _conditionInitialized; |
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | /*! * @brief Blocks the current thread until another thread calls @ref signal or * @ref broadcast. */ - (void)wait; /*! * @brief Signals the next waiting thread to continue. */ - (void)signal; /*! * @brief Signals all threads to continue. */ - (void)broadcast; @end | > > > > > > > > > > > > > > > > > > | 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 | /*! * @brief Blocks the current thread until another thread calls @ref signal or * @ref broadcast. */ - (void)wait; /*! * @brief Blocks the current thread until another thread calls @ref signal, * @ref broadcast or the timeout is reached. * * @param timeInterval The time interval until the timeout is reached * @return Whether the condition has been signaled */ - (bool)waitForTimeInterval: (double)timeInterval; /*! * @brief Blocks the current thread until another thread calls @ref signal, * @ref broadcast or the timeout is reached. * * @param date The date at which the timeout is reached * @return Whether the condition has been signaled */ - (bool)waitUntilDate: (OFDate*)date; /*! * @brief Signals the next waiting thread to continue. */ - (void)signal; /*! * @brief Signals all threads to continue. */ - (void)broadcast; @end |
Modified src/OFCondition.m from [ece321bbec] to [ece7460b2e].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * 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" | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFCondition.h" #import "OFDate.h" #import "OFConditionBroadcastFailedException.h" #import "OFConditionSignalFailedException.h" #import "OFConditionStillWaitingException.h" #import "OFConditionWaitFailedException.h" #import "OFInitializationFailedException.h" |
︙ | ︙ | |||
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - (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]; | > > > > > > > > > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - (void)wait { if (!of_condition_wait(&_condition, &_mutex)) @throw [OFConditionWaitFailedException exceptionWithClass: [self class] condition: self]; } - (bool)waitForTimeInterval: (double)timeInterval { return of_condition_timed_wait(&_condition, &_mutex, timeInterval); } - (bool)waitUntilDate: (OFDate*)date { return of_condition_timed_wait(&_condition, &_mutex, [date timeIntervalSinceNow]); } - (void)signal { if (!of_condition_signal(&_condition)) @throw [OFConditionSignalFailedException exceptionWithClass: [self class] condition: self]; |
︙ | ︙ |