JSON

LINUX_C_SIGNAL

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-01-31 15:02 ÎÒÒªÆÀÂÛ( )

ѧϰlinuxÏÂc±à³ÌµÄÐźÅÕâÒ»Õ£¬×öÒ»×ö±Ê¼Ç°É¡£³£ÓõÄ4¸ö·¢³öÐźŵÄϵͳº¯Êýkill,raise,alarm,setitimer¡£killÏòÖ¸¶¨µÄ½ø³Ì·¢ËÍÐźÅraiseÏò×Ô¼º·¢ËÍsigÐźÅalarm

ѧϰlinuxÏÂc±à³ÌµÄÐźÅÕâÒ»Õ£¬×öÒ»×ö±Ê¼Ç°É¡£
³£ÓõÄ4¸ö·¢³öÐźŵÄϵͳº¯Êýkill,raise,alarm,setitimer¡£
killÏòÖ¸¶¨µÄ½ø³Ì·¢ËÍÐźÅ
raiseÏò×Ô¼º·¢ËÍsigÐźÅ
alarmÊǶ¨Ê±Æ÷£¬µÈ¹æ¶¨Ê±¼äµ½ÁËÏò×Ô¼º·¢ËÍSIGALRMÐźš£
setitimer,ÉèÖÃÒ»¶Îʱ¼äʹµÃ³ÌÐò¼ä¸ôÖ´ÐС££¨¾ßÌåûÓùý£¬²»ËµºÜÁ˽⣩

ÐźŲÙ×÷ º¯Êý ½âÊÍ int sigemptyset(sigset_t *set) ³õʼ»¯ÐźÅset£¬½«ÆäÉèΪ¿Õ int sigfillset(sigset_t *set) ³õʼ»¯set£¬½«ÆäÉèΪËùÓÐÐźŵļ¯ºÏ int sigaddset(sigset_t *set,int signo) ½«signo¼ÓÈëset¼¯ºÏÖÐ int sigdelset(sigset_t *set,int signo) ½«signo´ÓsetÖÐɾ³ý int sigismember(sigset_t *set,int signo) ²éѯsignoÊÇ·ñÔÚsetÖÐ int sigprocmask(int how,const sigset_t *set,sigset_t *oset) ½«Ö¸¶¨Ðźż¯ºÏ¼ÓÈë½ø³Ì×èÈû¼¯ºÏÖУ¬osetÊDZ£´æÔ­À´µÄ×èÈû¼¯ºÏ£¬Ò»°ãΪnull£¬howÊǺ¯Êý²Ù×÷·½Ê½£¬SIG_BLOCK£ºÔö¼ÓÐźż¯ºÏµ½µ±Ç°¶ÓÁÐÖУ»SIG_UNBLOCK£º´Óµ±Ç°×èÈû¼¯ºÏÖÐɾ³ýÒ»¸öÐźż¯ºÏ£»SIG_SETMASK£ºÉèÖõ±Ç°Ðźż¯ºÏΪ×èÈû¼¯ºÏ int sigaction(int signo,const struct sigaction *act,struct sigaction *oact) Öض¨ÒåÐźŷ¢Ë͵Ķ¯×÷£¬Í¬ÉÏ£¬actΪÌí¼ÓµÄ¶¯×÷£¬oactΪ±»Ìæ»»±£´æµÄ¶¯×÷ int pause(void ) ¹ÒÆðµ±Ç°½ø³ÌÖ±µ½Ðźŷ¢Éú int sigsuspend(const sigset_t *sigmask) ¹ÒÆð½ø³Ì£¬µ÷ÓõÄʱºòÓÃsigmaskÈ¡´úµ±Ç°×èÈû¼¯ºÏ

struct sigaction{
void (*sa_handler)(int signo);
void (*sa_sigaction)(int siginfo_t *info,void *act);
sigset_t sa_mask;
int sa_flags;
void (*sa_restore)(void);
}

×¢£ºsignoÖÐÐźŲ鿴man 7 signal
¹ØÓÚÕâ¸ö£¬Õâ벩Ö÷½²µÄ±È½ÏÏêϸ£º

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • Linux Tasklet

    Linux Tasklet

    2017-01-31 15:03

  • Linux json½âÎöjq

    Linux json½âÎöjq

    2017-01-10 08:00

  • »ªÇåÔ¶¼ûǶÈëʽѧԺ

    »ªÇåÔ¶¼ûǶÈëʽѧԺ

    2016-09-30 15:00

  • ÐÖµÜÁ¬ThinkPHPÊÓƵ½Ì³Ì

    ÐÖµÜÁ¬ThinkPHPÊÓƵ½Ì³Ì

    2016-08-18 13:00

ÍøÓѵãÆÀ
À