Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:01:50

0001 #ifndef FWCore_Concurrency_hardware_pause_h
0002 #define FWCore_Concurrency_hardware_pause_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Concurrency
0006 // Class  :     hardware_pause
0007 //
0008 /**\class hardware_pause hardware_pause.h FWCore/Concurrency/interface/hardware_pause.h
0009 
0010  Description: assembler instruction to allow a short pause
0011 
0012  Usage:
0013     This hardware instruction tells the CPU to pause momentarily. This can be useful
0014  in the case where one is doing a 'spin lock' on a quantity that you expect to change
0015  within a few clock cycles.
0016 
0017 */
0018 //
0019 // Original Author:  Chris Jones
0020 //         Created:  Thu Feb 21 13:55:57 CST 2013
0021 // $Id$
0022 //
0023 
0024 //NOTE: Taken from libdispatch shims/atomics.h
0025 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
0026 #define hardware_pause() asm("")
0027 #endif
0028 #if defined(__x86_64__) || defined(__i386__)
0029 #undef hardware_pause
0030 #define hardware_pause() asm("pause")
0031 #endif
0032 
0033 #endif