İşletim Sistemleri (Bahar-2016) Hafta-5/1
Thread Örneği:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include<iostream> #include<unistd.h> #include<pthread.h> using namespace std; void * islem(void *arg) { cout<<"THREAD BASLADI!!"<<endl; sleep(10); pthread_exit(0); } int main() { pthread_t iplik; cout<<"PROC ID:"<<getpid()<<endl; pthread_create(&iplik,NULL,islem,NULL); cout<<"THREAD BEKLE"<<endl; pthread_join(iplik,NULL); cout<<"ANA PROC SONLANDI"<<endl; } |
Okumaya devam et
Son Yorumlar