signal_pending()

检测进程p是否有待处理的信号(p->thread_info->flags中TIF_SIGPENDING位是否置位)
-----------------------------------------------------
static inline int  signal_pending (struct task_struct *p)
{
    return unlikely(test_tsk_thread_flag(p, TIF_SIGPENDING));
}
#define TIF_SIGPENDING      2   /* signal pending */



-----------------------------------------------------
static inline int  test_tsk_thread_flag (struct task_struct *tsk, int flag)
{
    return test_ti_thread_flag(task_thread_info(tsk), flag);
}



-----------------------------------------------------
static inline int  test_ti_thread_flag (struct thread_info *ti, int flag)
{   
    return test_bit(flag, &ti->flags);
}




检测addr的第nr位是否为1(addr右起最低位为第0位)
-----------------------------------------------------
static inline int  test_bit (int nr, const volatile void * addr) 
{   
    return  ( 1UL &  ( ((const int *) addr)[nr >> 5] >> (nr & 31) )  ) != 0UL;
}

你可能感兴趣的:(linux)