@@ -163,22 +163,30 @@ class Socket {
163
163
* The callback may be called in an interrupt context and should not
164
164
* perform expensive operations such as recv/send calls.
165
165
*
166
+ * Note! This is not intended as a replacement for a poll or attach-like
167
+ * asynchronous api, but rather as a building block for constructing
168
+ * such functionality. The exact timing of when the registered function
169
+ * is called is not guaranteed and susceptible to change.
170
+ *
166
171
* @param func Function to call on state change
167
172
*/
168
- void attach (mbed::Callback<void ()> func);
173
+ void sigio (mbed::Callback<void ()> func);
169
174
170
175
/* * Register a callback on state change of the socket
171
176
*
172
- * The specified callback will be called on state changes such as when
173
- * the socket can recv/send/accept successfully and on when an error
174
- * occurs. The callback may also be called spuriously without reason.
175
- *
176
- * The callback may be called in an interrupt context and should not
177
- * perform expensive operations such as recv/send calls.
178
- *
179
- * @param obj Pointer to object to call method on
180
- * @param method Method to call on state change
177
+ * @see Socket::sigio
178
+ * @deprecated
179
+ * The behaviour of Socket::attach differs from other attach functions in
180
+ * mbed OS and has been known to cause confusion. Replaced by Socket::sigio.
181
+ */
182
+ MBED_DEPRECATED_SINCE (" mbed-os-5.4" ,
183
+ " The behaviour of Socket::attach differs from other attach functions in "
184
+ " mbed OS and has been known to cause confusion. Replaced by Socket::sigio." )
185
+ void attach (mbed::Callback<void ()> func);
186
+
187
+ /* * Register a callback on state change of the socket
181
188
*
189
+ * @see Socket::sigio
182
190
* @deprecated
183
191
* The attach function does not support cv-qualifiers. Replaced by
184
192
* attach(callback(obj, method)).
0 commit comments