@@ -14,11 +14,13 @@ * file. */ #import "OFObject.h" #import "OFStream.h" -#import "OFTCPSocket.h" +#ifdef OF_HAVE_SOCKETS +# import "OFTCPSocket.h" +#endif @class OFSortedList; #ifdef OF_HAVE_THREADS @class OFMutex; #endif @@ -33,12 +35,14 @@ { OFSortedList *_timersQueue; #ifdef OF_HAVE_THREADS OFMutex *_timersQueueLock; #endif +#ifdef OF_HAVE_SOCKETS OFStreamObserver *_streamObserver; OFMutableDictionary *_readQueues; +#endif volatile bool _running; } /*! * @brief Returns the main run loop. @@ -53,10 +57,11 @@ * @return The run loop for the current thread */ + (OFRunLoop*)currentRunLoop; + (void)OF_setMainRunLoop: (OFRunLoop*)runLoop; +#ifdef OF_HAVE_SOCKETS + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer length: (size_t)length target: (id)target selector: (SEL)selector; @@ -70,11 +75,11 @@ target: (id)target selector: (SEL)selector; + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket target: (id)target selector: (SEL)selector; -#ifdef OF_HAVE_BLOCKS +# ifdef OF_HAVE_BLOCKS + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block; + (void)OF_addAsyncReadForStream: (OFStream*)stream @@ -84,12 +89,13 @@ + (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 +# endif + (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream; +#endif /*! * @brief Adds an OFTimer to the run loop. * * @param timer The timer to add