zoukankan      html  css  js  c++  java
  • fork的微妙问题2

       1:  /*
       2:  author:justinzhang
       3:  email:uestczhangchao@gmail.com
       4:  time:2012-8-30 22:53:33
       5:  desc: from a interview question, fork plus printf buffer is a littel tricky~~
       6:  */
       7:  #include <stdio.h>
       8:  #include <stdlib.h>
       9:   
      10:  int main()
      11:  {
      12:  int i = 0;
      13:  for(i=0; i<2; i++)
      14:  {
      15:      fork();
      16:      printf("-");
      17:      fflush(stdout);
      18:  //    printf("-\n");
      19:  }
      20:  exit(0);
      21:  }
  • 相关阅读:
    冷门JS技巧
    JavaScript小技巧整理篇(非常全)
    JS实现标签页切换效果
    MySQL主从配置详解
    mysql主从复制(超简单)
    1.4isAlive()方法
    1.3currentThread()方法
    1.2.4注意Sysyem.out.println与i--
    1.2.3实例变量与线程安全
    1.2.2实现Runnable接口
  • 原文地址:https://www.cnblogs.com/justinzhang/p/2667196.html
Copyright © 2011-2022 走看看