原创 編寫一unix程序,防止殭屍進程的出現.

殭屍進程的避免 ⒈父進程通過wait和waitpid等函數等待子進程結束,這會導致父進程掛起。 ⒉ 如果父進程很忙,那麼可以用signal函數爲SIGCHLD安裝handler,因爲子進程結束後, 父進程會收到該信號,可以在hand

原创 兼容性編程經驗

void fan(short * x) { short x1=256; *x=x1; } int main() { int x=0; fan((short *)&x); printf("x:%d\r\n",x); while(