*nix&&C/C++
66
signal -c99 vs signal vs sigaction
/* 对除了SIGALRM之外的信号中断的系统调用,我们都希望其能自动重启动。 这是因为,对于SIGALRM,我们希望其用于计时系统调用,以对于超时的系统调用可以正常的中断。 */ Sigfunc signal(int signo, Sigfunc func) { struct sigaction act, oact; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; if( signo == SIGALRM ) { #ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT; #endif } else{ act.sa_flags |= SA_RESTART; } if( sigaction(signo, &act, &oact) <0 ) return(SIG_ERR);
return(oact.sa_handler); }
*nix系统的日志系统,
ultimate void (*signal(int, void (*fp)(int)))(int);
In a map, the key values are generally used to sort and uniquely identify the elements, while the mapped values store the content associated to this key.
The types of key and mapped value may differ, and are grouped together in member type value_type, which is a pair type combining both:
Linux IO模式及 select、poll、epoll详解
std::vector::at
The function automatically checks whether n is within the bounds of valid elements in the vector,
throwing an out_of_range exception if it is not (i.e., if n is greater than, or equal to, its size).
This is in contrast with member operator[], that does not check against bounds.
Where and why do I have to put the “template” and “typename” keywords?