Esempio n. 1
0
 void count_up(){
   for(m_count=1;m_count<N;m_count++){
       m_print_sem.put();
       m_count_sem.take();
   }
   cout<<"count up () finished"<<endl;
   m_done=true;
   m_print_sem.put();
 }
Esempio n. 2
0
 void print(){
   do{
     m_print_sem.take();
     cout<<"Counting: "<<m_count<<endl;
     cout<<flush;
     m_count_sem.put();
   }while(!m_done);
   cout<<"print() finished"<<endl;
 }