Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. signal(SIGALRM, timeouthandler);
  2. alarm(3);
  3. ...(connection to a server that may hang)...
  4.  
  5. alarm(0);
  6.  
  7. timeouthandler(){
  8. ...(connection to a server that may hang)...
  9. }
  10.  
  11. signal(SIGALRM, timeouthandler2);
  12. alarm(3);
  13. ...(log the time out)...
  14.  
  15. alarm(0);
  16.  
  17. timeouthandler2(){
  18. ...(log the time out)...
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement