İşletim Sistemleri (Bahar-2016) Hafta-5/1
Thread Örneği:
#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; }