2010-01-22 24 views

cevap

8
  1. İndir pthreads Download
  2. o Proje menüsüne gidin sonra Dev C++ içinde
  3. yeni projesi oluşturma
  4. ++ Dev C kurun DEVPAK> Bu seçmek "Parametre Tab"
  5. yılında
  6. "Kitaplık veya nesne ekle" seçeneğini belirleyin.
  7. Dev C++ yükleme dizininden "libpthreadGC2.a" dosyasını seçin. LIB dizininde olacaktır. çalıştırmak için hazır
  8. basın ok
  9. Şimdi testi aşağıdaki örnek kod ..

Örnek Kod:

#include <iostream> 
#include <pthread.h> 
using namespace std; 
void * fun_thread1(void *data) 
{ 
    for(int i=0;i<100;i++) 
    { 
     cout<<endl<<"In Thread 1"<<endl; 
    }  
} 
void * fun_thread2(void *data) 
{ 
    for(int i=0;i<100;i++) 
    { 
     cout<<endl<<"In Thread 2"<<endl; 
    }  
} 
int main(int argc, char *argv[]) 
{ 
    int status; 
    // creating thread objects 
    pthread_t thrd_1; 
    pthread_t thrd_2; 
    // create thread 
    pthread_create(&thrd_1,NULL,fun_thread1,(void *)0); 
    pthread_create(&thrd_2,NULL,fun_thread2,(void *)0);  
    pthread_join(thrd_1, (void **)&status); 
    pthread_join(thrd_2, (void **)&status); 
    system("PAUSE"); 
    return EXIT_SUCCESS; 
} 
+0

404 yılında DEVPAK sonuçlarına bağlantı. –

İlgili konular