Home | History | Annotate | Download | only in multithreaded
      1 
      2 #include <iostream>
      3 
      4 using namespace std;
      5 
      6 int next() {
      7   static int i = 0;
      8   cout << "incrementing " << i << endl;
      9   return ++i;
     10 }
     11 
     12 int main() {
     13   int i = 0;
     14   while (i < 5)
     15     i = next();
     16   return 0;
     17 }
     18