scout_synch.c
来自「java 到c的转换程序的原代码.对喜欢C程序而不懂JAVA程序的人很有帮助」· C语言 代码 · 共 48 行
C
48 行
/* Synchronization routines to use while running in UNIX */#include <signal.h>static sigset_t blockmask;static sigset_t oldmask;static int inited = 0;static int count = 0;longsynchEnableInterrupts (void){ if (!inited) { return; /* No need to enable if nothing has been disabled yet */ } /* reset the sigmask to what it was when we were called */ if (count == 0) return 0; if (--count == 0) sigprocmask(SIG_SETMASK, &oldmask, 0); return 0;}longsynchDisableInterrupts (void){ if (!inited) { sigfillset(&blockmask); inited = 1; } /* Block out all signals */ if (count++ == 0) sigprocmask(SIG_BLOCK, &blockmask, &oldmask); return 0;}longsynchRestoreInterrupts (void){ synchEnableInterrupts(); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?