睡眠排序

#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(int c, char **v)
{
  while (--c > 1 && !fork());
  sleep(c = atoi(v[c]));
  printf("%d\n", c);
  wait(0);
  return 0;
}

  

posted @ 2020-01-01 20:31  Smah  阅读(295)  评论(0编辑  收藏  举报