@@ -38,18 +38,40 @@ extern NSString *const XMPPStreamDidChangeMyJIDNotification;
38
38
@interface XMPPStream (/* Internal */ )
39
39
40
40
/* *
41
- * Categories on XMPPStream should maintain thread safety by dispatching through the internal xmppQueue.
42
- * They may also need to ensure the stream is in the proper state for their activity.
41
+ * XMPPStream maintains thread safety by dispatching through the internal serial xmppQueue.
42
+ * Subclasses of XMPPStream MUST follow the same technique:
43
+ *
44
+ * dispatch_block_t block = ^{
45
+ * // Code goes here
46
+ * };
47
+ *
48
+ * if (dispatch_get_specific(xmppQueueTag))
49
+ * block();
50
+ * else
51
+ * dispatch_sync(xmppQueue, block);
52
+ *
53
+ * Category methods may or may not need to dispatch through the xmppQueue.
54
+ * It depends entirely on what properties of xmppStream the category method needs to access.
55
+ * For example, if a category only accesses a single property, such as the rootElement,
56
+ * then it can simply fetch the atomic property, inspect it, and complete its job.
57
+ * However, if the category needs to fetch multiple properties, then it likely needs to fetch all such
58
+ * properties in an atomic fashion. In this case, the category should likely go through the xmppQueue,
59
+ * to ensure that it gets an atomic state of the xmppStream in order to complete its job.
43
60
**/
61
+ @property (nonatomic , readonly ) dispatch_queue_t xmppQueue;
62
+ @property (nonatomic , readonly ) void *xmppQueueTag;
44
63
45
- @property (readonly ) dispatch_queue_t xmppQueue;
46
- @property (readonly ) void *xmppQueueTag;
47
- @property (readonly ) XMPPStreamState state;
64
+ /* *
65
+ * Returns the current state of the xmppStream.
66
+ **/
67
+ @property (atomic , readonly ) XMPPStreamState state;
48
68
49
69
/* *
50
70
* This method is for use by xmpp authentication mechanism classes.
51
- * They should send elements using this method instead of the public sendElement classes ,
71
+ * They should send elements using this method instead of the public sendElement methods ,
52
72
* as those methods don't send the elements while authentication is in progress.
73
+ *
74
+ * @see XMPPSASLAuthentication
53
75
**/
54
76
- (void )sendAuthElement : (NSXMLElement *)element ;
55
77
0 commit comments