ObjFW  Diff

Differences From Artifact [85b360a246]:

To Artifact [7f3a6cb32d]:


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
/**
 * \brief This callback is called when a stream did get ready for reading.
 *
 * NOTE: When -[tryReadLine] or -[tryReadTillDelimiter:] has been called on the
 *	 the stream, this callback will not be called again until new data has
 *	 been received, even though there is still data in the cache. The reason
 *	 for this is to prevent spinning in a loop when there is an incomplete
 *	 string in the cache. Once the string is complete, the callback will be
 *	 called again if there is data in the cache.
 *
 * \param stream The stream which did become ready for reading







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
/**
 * \brief This callback is called when a stream did get ready for reading.
 *
 * \note When \ref tryReadLine or \ref tryReadTillDelimiter: has been called on
 *	 the stream, this callback will not be called again until new data has
 *	 been received, even though there is still data in the cache. The reason
 *	 for this is to prevent spinning in a loop when there is an incomplete
 *	 string in the cache. Once the string is complete, the callback will be
 *	 called again if there is data in the cache.
 *
 * \param stream The stream which did become ready for reading
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 */
- (void)streamDidReceiveException: (OFStream*)stream;
@end

/**
 * \brief A class that can observe multiple streams at once.
 *
 * Note: Currently, Win32 can only observe sockets and not files!
 */
@interface OFStreamObserver: OFObject
{
	OFMutableArray *readStreams;
	OFMutableArray *writeStreams;
	__unsafe_unretained OFStream **FDToStream;
	size_t maxFD;







|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 */
- (void)streamDidReceiveException: (OFStream*)stream;
@end

/**
 * \brief A class that can observe multiple streams at once.
 *
 * \note Currently, Win32 can only observe sockets and not files!
 */
@interface OFStreamObserver: OFObject
{
	OFMutableArray *readStreams;
	OFMutableArray *writeStreams;
	__unsafe_unretained OFStream **FDToStream;
	size_t maxFD;
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
 * \brief Adds a stream to observe for reading.
 *
 * This is also used to observe a listening socket for incoming connections,
 * which then triggers a read event for the observed stream.
 *
 * It is recommended that the stream you add is set to non-blocking mode.
 *
 * If there is an -[observe] call blocking, it will be canceled. The reason for
 * this is to prevent blocking even though the new added stream is ready.
 *
 * \param stream The stream to observe for reading
 */
- (void)addStreamForReading: (OFStream*)stream;

/**
 * \brief Adds a stream to observe for writing.
 *
 * It is recommended that the stream you add is set to non-blocking mode.
 *
 * If there is an -[observe] call blocking, it will be canceled. The reason for
 * this is to prevent blocking even though the new added stream is ready.
 *
 * \param stream The stream to observe for writing
 */
- (void)addStreamForWriting: (OFStream*)stream;

/**
 * \brief Removes a stream to observe for reading.
 *
 * If there is an -[observe] call blocking, it will be canceled. The reason for
 * this is to prevent the removed stream from still being observed.
 *
 * \param stream The stream to remove from observing for reading
 */
- (void)removeStreamForReading: (OFStream*)stream;

/**
 * \brief Removes a stream to observe for writing.
 *
 * If there is an -[observe] call blocking, it will be canceled. The reason for
 * this is to prevent the removed stream from still being observed.
 *
 * \param stream The stream to remove from observing for writing
 */
- (void)removeStreamForWriting: (OFStream*)stream;

/**
 * \brief Observes all streams and blocks until an event happens on a stream.







|
|










|
|








|
|








|
|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
 * \brief Adds a stream to observe for reading.
 *
 * This is also used to observe a listening socket for incoming connections,
 * which then triggers a read event for the observed stream.
 *
 * It is recommended that the stream you add is set to non-blocking mode.
 *
 * If there is an \ref observe call blocking, it will be canceled. The reason
 * for this is to prevent blocking even though the new added stream is ready.
 *
 * \param stream The stream to observe for reading
 */
- (void)addStreamForReading: (OFStream*)stream;

/**
 * \brief Adds a stream to observe for writing.
 *
 * It is recommended that the stream you add is set to non-blocking mode.
 *
 * If there is an \ref observe call blocking, it will be canceled. The reason
 * for this is to prevent blocking even though the new added stream is ready.
 *
 * \param stream The stream to observe for writing
 */
- (void)addStreamForWriting: (OFStream*)stream;

/**
 * \brief Removes a stream to observe for reading.
 *
 * If there is an \ref observe call blocking, it will be canceled. The reason
 * for this is to prevent the removed stream from still being observed.
 *
 * \param stream The stream to remove from observing for reading
 */
- (void)removeStreamForReading: (OFStream*)stream;

/**
 * \brief Removes a stream to observe for writing.
 *
 * If there is an \ref observe call blocking, it will be canceled. The reason
 * for this is to prevent the removed stream from still being observed.
 *
 * \param stream The stream to remove from observing for writing
 */
- (void)removeStreamForWriting: (OFStream*)stream;

/**
 * \brief Observes all streams and blocks until an event happens on a stream.