Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 2nd, 2012  |  syntax: C  |  size: 0.29 KB  |  views: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <unistd.h>
  2. #include <stdio.h>
  3.  
  4. void fast() {
  5.   int i;
  6.   for (i = 0; i < 2000; i++)
  7.     printf("Doing some fast work %d\n", i);
  8. }
  9.  
  10. void slow() {
  11.   printf("Doing some slow non-CPU-bound work\n");
  12.   sleep(3);
  13. }
  14.  
  15. int main() {
  16.   fast();
  17.   slow();
  18.   fast();
  19.  
  20.   return 0;
  21. }