Overview
Comment: | Make it possible to cancel async requests. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
dc7b33cd6bff514862297e6febbb2749 |
User & Date: | js on 2012-12-19 20:55:18 |
Other Links: | manifest | tags |
Context
2012-12-19
| ||
22:19 | objfw-config: Never output more than one line. check-in: bd6a799986 user: js tags: trunk | |
20:55 | Make it possible to cancel async requests. check-in: dc7b33cd6b user: js tags: trunk | |
2012-12-16
| ||
15:09 | Fix a comment that accidentally was documentation. check-in: 49f58f3edd user: js tags: trunk | |
Changes
Modified src/OFRunLoop.h from [eb85eb1d39] to [414cbc9314].
︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | block: (of_stream_async_read_block_t)block; + (void)OF_addAsyncReadLineForStream: (OFStream*)stream encoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket block: (of_tcpsocket_async_accept_block_t)block; #endif /*! * @brief Adds an OFTimer to the run loop. * * @param timer The timer to add */ - (void)addTimer: (OFTimer*)timer; | > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | block: (of_stream_async_read_block_t)block; + (void)OF_addAsyncReadLineForStream: (OFStream*)stream encoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket block: (of_tcpsocket_async_accept_block_t)block; #endif + (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream; /*! * @brief Adds an OFTimer to the run loop. * * @param timer The timer to add */ - (void)addTimer: (OFTimer*)timer; |
︙ | ︙ |
Modified src/OFRunLoop.m from [5845195cdf] to [cee8e6c735].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * 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 "OFRunLoop.h" #import "OFDictionary.h" #import "OFThread.h" #import "OFSortedList.h" #import "OFMutex.h" #import "OFTimer.h" | > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * 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" #include <assert.h> #import "OFRunLoop.h" #import "OFDictionary.h" #import "OFThread.h" #import "OFSortedList.h" #import "OFMutex.h" #import "OFTimer.h" |
︙ | ︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | ADD(OFRunLoop_AcceptQueueItem, { queueItem->block = [block copy]; }) } #endif #undef ADD - init { self = [super init]; @try { timersQueue = [[OFSortedList alloc] init]; | > > > > > > > > > > > > > > > > | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | ADD(OFRunLoop_AcceptQueueItem, { queueItem->block = [block copy]; }) } #endif #undef ADD + (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream { void *pool = objc_autoreleasePoolPush(); OFRunLoop *runLoop = [self currentRunLoop]; OFList *queue; if ((queue = [runLoop->readQueues objectForKey: stream]) != nil) { assert([queue count] > 0); [runLoop->streamObserver removeStreamForReading: stream]; [runLoop->readQueues removeObjectForKey: stream]; } objc_autoreleasePoolPop(pool); } - init { self = [super init]; @try { timersQueue = [[OFSortedList alloc] init]; |
︙ | ︙ |
Modified src/OFStream.h from [bcd97aa0de] to [15b2bdf6af].
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | /*! * @brief Returns the file descriptor for the write end of the stream. * * @return The file descriptor for the write end of the stream */ - (int)fileDescriptorForWriting; /*! * @brief Closes the stream. */ - (void)close; /*! * @brief Performs a lowlevel read. | > > > > > | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | /*! * @brief Returns the file descriptor for the write end of the stream. * * @return The file descriptor for the write end of the stream */ - (int)fileDescriptorForWriting; /*! * @brief Cancels all pending asyncronous requests on the stream. */ - (void)cancelAsyncRequests; /*! * @brief Closes the stream. */ - (void)close; /*! * @brief Performs a lowlevel read. |
︙ | ︙ |
Modified src/OFStream.m from [38e80261fb] to [4d480da639].
︙ | ︙ | |||
719 720 721 722 723 724 725 | return line; } - (void)asyncReadLineWithTarget: (id)target selector: (SEL)selector { | | | | | | | 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | return line; } - (void)asyncReadLineWithTarget: (id)target selector: (SEL)selector { [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 target: target selector: selector]; } - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadLineForStream: self encoding: encoding target: target selector: selector]; } #ifdef OF_HAVE_BLOCKS - (void)asyncReadLineWithBlock: (of_stream_async_read_line_block_t)block { [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 block: block]; } - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block { [OFRunLoop OF_addAsyncReadLineForStream: self encoding: encoding |
︙ | ︙ | |||
1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | } - (int)fileDescriptorForWriting { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (void)close { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (BOOL)OF_isWaitingForDelimiter { return waitingForDelimiter; } @end | > > > > > | 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 | } - (int)fileDescriptorForWriting { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (void)cancelAsyncRequests { [OFRunLoop OF_cancelAsyncRequestsForStream: self]; } - (void)close { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (BOOL)OF_isWaitingForDelimiter { return waitingForDelimiter; } @end |