1 | void (*signal (int sigNum, void (*sigHandler)(int))) (int); |
1 2 | typedef void sigHandler(int); SigHandler *signal(int, sigHandler *); |
1 | temp += 1; |
1 2 3 | mov ax,[temp] inc ax mov [temp],ax |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <signal.h> #include <stdio.h> struct two_int { int a, b; } data; void signal_handler(int signum){ printf ("%d, %d\n", data.a, data.b); alarm (1); } int main (void){ static struct two_int zeros = { 0, 0 }, ones = { 1, 1 }; signal (SIGALRM, signal_handler); data = zeros; alarm (1); while (1) {data = zeros; data = ones;} } |
1 2 3 4 5 6 7 8 | 0, 0 1, 1 (Skipping some output...) 0, 1 1, 1 1, 0 1, 0 ... |
1 | static struct hostent host; /* result stored here*/ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | main(){ struct hostent *hostPtr; ... signal(SIGALRM, sig_handler); ... hostPtr = gethostbyname(hostNameOne); ... } void sig_handler(){ struct hostent *hostPtr; ... /* call to gethostbyname may clobber the value stored during the call inside the main() */ hostPtr = gethostbyname(hostNameTwo); ... } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |