@@ -93,6 +93,7 @@ CF_INLINE CFRunLoopSourceRef _CFStreamCopySource(struct _CFStream* stream) {
93
93
}
94
94
95
95
CF_INLINE void _CFStreamSetSource (struct _CFStream * stream , CFRunLoopSourceRef source , Boolean invalidateOldSource ) {
96
+ #if __HAS_DISPATCH__
96
97
CFRunLoopSourceRef oldSource = NULL ;
97
98
98
99
if (stream ) {
@@ -119,6 +120,7 @@ CF_INLINE void _CFStreamSetSource(struct _CFStream* stream, CFRunLoopSourceRef s
119
120
// And lose the one that held it in our stream as well
120
121
CFRelease (oldSource );
121
122
}
123
+ #endif
122
124
}
123
125
124
126
CF_INLINE const struct _CFStreamCallBacks * _CFStreamGetCallBackPtr (struct _CFStream * stream ) {
@@ -135,6 +137,7 @@ CF_INLINE void _CFStreamSetStatusCode(struct _CFStream *stream, CFStreamStatus n
135
137
}
136
138
137
139
CF_INLINE void _CFStreamScheduleEvent (struct _CFStream * stream , CFStreamEventType event ) {
140
+ #if __HAS_DISPATCH__
138
141
if (stream -> client && (stream -> client -> when & event )) {
139
142
CFRunLoopSourceRef source = _CFStreamCopySource (stream );
140
143
if (source ) {
@@ -145,6 +148,7 @@ CF_INLINE void _CFStreamScheduleEvent(struct _CFStream *stream, CFStreamEventTyp
145
148
_wakeUpRunLoop (stream );
146
149
}
147
150
}
151
+ #endif
148
152
}
149
153
150
154
CF_INLINE void _CFStreamSetStreamError (struct _CFStream * stream , CFStreamError * err ) {
@@ -203,6 +207,7 @@ static void _CFStreamDetachSource(struct _CFStream* stream) {
203
207
204
208
CFAssert (CFArrayGetFirstIndexOfValue (list , CFRangeMake (0 , CFArrayGetCount (list )), stream ) == kCFNotFound , __kCFLogAssertion , "CFStreamClose: stream found twice in its shared source's list" );
205
209
210
+ #if __HAS_DISPATCH__
206
211
if (count == 0 ) {
207
212
CFRunLoopSourceRef source = _CFStreamCopySource (stream );
208
213
if (source ) {
@@ -211,6 +216,7 @@ static void _CFStreamDetachSource(struct _CFStream* stream) {
211
216
}
212
217
CFDictionaryRemoveValue (sSharedSources , runLoopAndSourceKey );
213
218
}
219
+ #endif
214
220
215
221
CFDictionaryRemoveValue (sSharedSources , stream );
216
222
@@ -653,6 +659,7 @@ static void _cfstream_shared_signalEventSync(void* info)
653
659
break ;
654
660
}
655
661
}
662
+ #if __HAS_DISPATCH__
656
663
657
664
/* And then we also signal any other streams in this array so that we get them next go? */
658
665
for (; i < c ; i ++ ) {
@@ -675,6 +682,7 @@ static void _cfstream_shared_signalEventSync(void* info)
675
682
break ;
676
683
}
677
684
}
685
+ #endif
678
686
679
687
__CFUnlock (& sSourceLock );
680
688
@@ -788,6 +796,7 @@ CF_PRIVATE void _CFStreamSignalEvent(struct _CFStream *stream, CFStreamEventType
788
796
_CFStreamSetStatusCode (stream , kCFStreamStatusError );
789
797
}
790
798
799
+ #if __HAS_DISPATCH__
791
800
// Now signal any pertinent event - if not already signaled
792
801
if (stream -> client && (stream -> client -> when & event ) != 0 && (stream -> client -> whatToSignal & event ) == 0 ) {
793
802
CFRunLoopSourceRef source = _CFStreamCopySource (stream );
@@ -824,6 +833,7 @@ CF_PRIVATE void _CFStreamSignalEvent(struct _CFStream *stream, CFStreamEventType
824
833
CFRelease (source );
825
834
}
826
835
}
836
+ #endif
827
837
}
828
838
829
839
CF_PRIVATE CFStreamStatus _CFStreamGetStatus (struct _CFStream * stream ) {
@@ -1469,6 +1479,7 @@ CF_PRIVATE void _CFStreamScheduleWithRunLoop(struct _CFStream *stream, CFRunLoop
1469
1479
count -- ;
1470
1480
}
1471
1481
1482
+ #if __HAS_DISPATCH__
1472
1483
if (count == 0 ) {
1473
1484
CFRunLoopSourceRef source = _CFStreamCopySource (stream );
1474
1485
if (source ) {
@@ -1477,6 +1488,7 @@ CF_PRIVATE void _CFStreamScheduleWithRunLoop(struct _CFStream *stream, CFRunLoop
1477
1488
}
1478
1489
CFDictionaryRemoveValue (sSharedSources , runLoopAndSourceKey );
1479
1490
}
1491
+ #endif
1480
1492
1481
1493
CFDictionaryRemoveValue (sSharedSources , stream );
1482
1494
@@ -1518,6 +1530,7 @@ CF_PRIVATE void _CFStreamScheduleWithRunLoop(struct _CFStream *stream, CFRunLoop
1518
1530
__CFBitClear (stream -> flags , CALLING_CLIENT );
1519
1531
}
1520
1532
1533
+ #if __HAS_DISPATCH__
1521
1534
/*
1522
1535
* If we've got events pending, we need to wake up and signal
1523
1536
*/
@@ -1529,6 +1542,7 @@ CF_PRIVATE void _CFStreamScheduleWithRunLoop(struct _CFStream *stream, CFRunLoop
1529
1542
_wakeUpRunLoop (stream );
1530
1543
}
1531
1544
}
1545
+ #endif
1532
1546
}
1533
1547
1534
1548
CF_EXPORT void CFReadStreamScheduleWithRunLoop (CFReadStreamRef stream , CFRunLoopRef runLoop , CFStringRef runLoopMode ) {
@@ -1568,11 +1582,13 @@ CF_PRIVATE void _CFStreamUnscheduleFromRunLoop(struct _CFStream *stream, CFRunLo
1568
1582
if (!stream -> client -> rlSource ) return ;
1569
1583
1570
1584
if (!__CFBitIsSet (stream -> flags , SHARED_SOURCE )) {
1585
+ #if __HAS_DISPATCH__
1571
1586
CFRunLoopSourceRef source = _CFStreamCopySource (stream );
1572
1587
if (source ) {
1573
1588
CFRunLoopRemoveSource (runLoop , source , runLoopMode );
1574
1589
CFRelease (source );
1575
1590
}
1591
+ #endif
1576
1592
} else {
1577
1593
CFArrayRef runLoopAndSourceKey ;
1578
1594
CFMutableArrayRef list ;
@@ -1590,6 +1606,7 @@ CF_PRIVATE void _CFStreamUnscheduleFromRunLoop(struct _CFStream *stream, CFRunLo
1590
1606
count -- ;
1591
1607
}
1592
1608
1609
+ #if __HAS_DISPATCH__
1593
1610
if (count == 0 ) {
1594
1611
CFRunLoopSourceRef source = _CFStreamCopySource (stream );
1595
1612
if (source ) {
@@ -1598,6 +1615,7 @@ CF_PRIVATE void _CFStreamUnscheduleFromRunLoop(struct _CFStream *stream, CFRunLo
1598
1615
}
1599
1616
CFDictionaryRemoveValue (sSharedSources , runLoopAndSourceKey );
1600
1617
}
1618
+ #endif
1601
1619
1602
1620
CFDictionaryRemoveValue (sSharedSources , stream );
1603
1621
@@ -1850,6 +1868,7 @@ dispatch_queue_t CFWriteStreamCopyDispatchQueue(CFWriteStreamRef stream)
1850
1868
#endif
1851
1869
1852
1870
static void waitForOpen (struct _CFStream * stream ) {
1871
+ #if __HAS_DISPATCH__
1853
1872
CFRunLoopRef runLoop = CFRunLoopGetCurrent ();
1854
1873
CFStringRef privateMode = CFSTR ("_kCFStreamBlockingOpenMode" );
1855
1874
_CFStreamScheduleWithRunLoop (stream , runLoop , privateMode );
@@ -1858,6 +1877,7 @@ static void waitForOpen(struct _CFStream *stream) {
1858
1877
CFRunLoopRunInMode (privateMode , 1e+20 , TRUE);
1859
1878
}
1860
1879
_CFStreamUnscheduleFromRunLoop (stream , runLoop , privateMode );
1880
+ #endif
1861
1881
}
1862
1882
1863
1883
CF_PRIVATE CFArrayRef _CFReadStreamCopyRunLoopsAndModes (CFReadStreamRef readStream ) {
0 commit comments