Browse Source

Added volatile qualifier to all atomic ivars.

It is still debated whether volatile is necessary or not,
however this change only causes a negligible optimization hit
while guaranteeing that the variables are not cached away.
Amir Khan 8 years ago
parent
commit
a6d5eb439b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.m

+ 3 - 3
MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.m

@@ -46,10 +46,10 @@
     dispatch_queue_t callbackQueue;
     dispatch_semaphore_t noticeHandlingSemaphore;
 
-    _Atomic PsiphonConnectionState connectionState;
+    volatile _Atomic PsiphonConnectionState connectionState;
 
-    _Atomic NSInteger localSocksProxyPort;
-    _Atomic NSInteger localHttpProxyPort;
+    volatile _Atomic NSInteger localSocksProxyPort;
+    volatile _Atomic NSInteger localHttpProxyPort;
 
     Reachability* reachability;
     NetworkStatus previousNetworkStatus;