test.c 312 B

1234567891011121314151617181920212223242526
  1. #include <stdio.h>
  2. #include <string.h>
  3. int TCP_RUN_NUMBER;
  4. /* 重新计时 */
  5. extern char again_udp(void)
  6. {
  7. if(TCP_RUN_NUMBER == 0)
  8. {
  9. return 1;
  10. }
  11. sleep(1);
  12. TCP_RUN_NUMBER--;
  13. return 0;
  14. }
  15. int main(void)
  16. {
  17. TCP_RUN_NUMBER = 5;
  18. while(1){
  19. if (again_udp())
  20. break;
  21. printf("1\n");
  22. }
  23. printf("2\n");
  24. }