Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unistd.h>
- #include <pthread.h>
- #include <iostream>
- using namespace std;
- int i = 0;
- void *scrivi(void *parametro)
- {
- while(i<=10){
- usleep(100000);
- cout<<"Ho scritto "<<i++<<endl;
- usleep(900000);
- }
- }
- int main()
- {
- pthread_t tid;
- pthread_create(&tid, 0, scrivi, 0);
- while(i<=10){
- cout << "Letto "<<i<<endl;
- sleep(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement