scout_synch.h

来自「java 到c的转换程序的原代码.对喜欢C程序而不懂JAVA程序的人很有帮助」· C头文件 代码 · 共 60 行

H
60
字号
#ifndef __x86_synch_h__#define __x86_synch_h__#ifndef LANGUAGE_ASSEMBLY#ifndef USER_LEVELextern inline longsynchEnableInterrupts (void){    register long result;    asm volatile ("pushfl ;		   popl %0 ;		   sti"		  : "r="(result)		  : );    return result;}extern inline longsynchDisableInterrupts (void){    register long result;    asm volatile (" ;		   pushfl ;		   popl %0 ;		   cli ;"		  : "r="(result)		  : );    return result;}extern inline voidsynchRestoreInterrupts (long flags){    asm volatile ("pushl %0;		   popfl ; "		  :		  : "r"(flags)		  : "cc");}#endif /* USER_LEVEL */#define synchAtomicSequence(as)						\({									\    register long as_flags;						\    as_flags = synchDisableInterrupts();				\    {as;}								\    synchRestoreInterrupts(as_flags);					\})#endif /* LANGUAGE_ASSEMBLY */#endif /* __x86_synch_h__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?