Bug 1204042 - make nsSocketTransportService::mTelemetryEnabledPref an atomic variable; r=mcmanus

This variable is written on the main thread (where we can access prefs),
but read on the socket thread on every poll iteration to decide whether
we should record telemetry information.  Making it atomic communicates
our intent to read/write the value on multiple threads without any
locking.  Using relaxed memory consistency is just as efficient as what
we have today, and it does not seem terribly crucial whether the *very
next* poll iteration records telemetry once the pref is updated, or
whether we can eventually get the correct value on the socket thread.
This commit is contained in:
Nathan Froyd 2015-09-11 21:03:53 -04:00
parent ac24c08b7f
commit fd7eb3b17b

View File

@ -239,7 +239,7 @@ private:
bool mServeMultipleEventsPerPollIter;
mozilla::Atomic<bool> mServingPendingQueue;
int32_t mMaxTimePerPollIter;
bool mTelemetryEnabledPref;
mozilla::Atomic<bool, mozilla::Relaxed> mTelemetryEnabledPref;
void OnKeepaliveEnabledPrefChange();
void NotifyKeepaliveEnabledPrefChange(SocketContext *sock);