On Thu, Mar 6, 2014 at 5:07 PM, Chris Jones <notifications@github.com>wrote:

> In EventFilter/Utilities/plugins/FastMonitoringService.h:
>
> > -					<< std::endl;
> > -
> > -			// lock the monitor
> > -			fmt_.monlock_.lock();
> > -			fmt_.m_data.macrostateJ_ = fmt_.m_data.macrostate_;
> > -			fmt_.m_data.ministateJ_ = encPath_.encode(fmt_.m_data.ministate_);
> > -			fmt_.m_data.microstateJ_ = encModule_.encode(
> > -					fmt_.m_data.microstate_);
> > -
> > -			fmt_.m_data.jsonMonitor_->snap(true, fastPath_);
> > -			fmt_.monlock_.unlock();
> > -
> > -			//::sleep(1);
> > -			::sleep(sleepTime_);
> > -		}
> > +	std::atomic_thread_fence(std::memory_order_acquire);
>
> std::atomic_thread_fence(std::memory_order_acquire) only works if you also
> have a std::atomic_thread_fence(std::memory_order_release) for which it is
> paired. All they do is make sure the CPU processor caches are flushed and
> updated between the acquire and release.
> As for why to avoid them, I read they did too much and too little when
> dealing with threading. Too much since they flush more memory and too
> little since getting all the calls properly paired is extremely error prone.
>

It looks like it was a bug where I put "acquire" instead of "release" in
the place above. So I pushed this commit  (now that it needs to be signed
again in any case).
Thanks for the explanation and other comments, I will fix those now.



>  --
> Reply to this email directly or view it on GitHub<https://github.com/cms-sw/cmssw/pull/2661/files#r10347517>
> .
>
Cheers,
Srecko