İşletim Sistemleri (Bahar-2016) Hafta-13
#include<iostream> #include<pthread.h> #include<unistd.h> using namespace std; void* asal(void* arg) { int* sayi = (int*) arg; int say = *sayi; int
Okumaya devam et#include<iostream> #include<pthread.h> #include<unistd.h> using namespace std; void* asal(void* arg) { int* sayi = (int*) arg; int say = *sayi; int
Okumaya devam et#include<iostream> #include<pthread.h> using namespace std; void* asal(void* arg) { long sayi = (long)(int*) arg; int sayac=0; for(int i=2;i<(sayi/2)+1;i++) if(sayi%i==0) {
Okumaya devam et#include<iostream> #include<signal.h> #include<pthread.h> #include<sys/syscall.h> #include <unistd.h> using namespace std; void yakala(int sinyaltipi) { cout<<“Sinyali yakalayan iplik:”<<syscall(SYS_gettid)<<“–“<<endl; } void * iplik_islem(void
Okumaya devam etThread Ö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()
Okumaya devam et
Son yorumlar