PDA

View Full Version : مبتدی: اجرای موازی دو ترد



fsima
شنبه 26 فروردین 1391, 15:45 عصر
سلام
میخوام برنامهایی بنویسم که دو تا ترد داشته باشه که موازی با هم (به صورت همزمان )اجرا بشند
به نظرتون کد زیر درسته
#include<Windows.h>
#include<process.h>
#include<omp.h>
void thread1(void *nothing);
void thread2(void *nothing);

int main()
{

#pragma omp paralle private(var3,var4) shared(var1,var2)
{

_beginthread(thread1,0,NULL);
_beginthread(thread2,0,NULL);
}



}
void thread1(void *nothing)
{

}
void thread2(void *nothing)
{
}