Hi everyone,
How do I create a multi threading program?
Hi everyone,
How do I create a multi threading program?
It depends on your platform. If you're on Linux, man the fork command.
Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction
search around for pthread examples. fork() just creates a child process
Hi Happy_Reaper,
let say I'm using visual C++ v6, how would you suggest? I had never tried multi thread before. so basically I doesn't know how to. Is there anything I can look out for?
I think windows has pthreads library, maybe not
try this
if not I donno...also this is the C Board, there is also a C++ one which you should probably have asked in since you're using C++Code:#include <pthread.h> #include <stdio.h> #include <stdlib.h> void *hello(void *arg) { printf("hello world\n"); } int main() { pthread_t thread_block; void *status; if (pthread_create(&thread_block, NULL, hello, NULL) != 0) { perror("pthread_create"); exit(1); } if (pthread_join(thread_block, &status) != 0) { perror("pthread_join"); exit(1); } return 0; }
Thanks sl4nted,
To be true my program are in c, even though I use a visual c++ to compile. I'm kind of a green horn so I would really like to try everything. I'll try the example that are listed .. thanks alot. =)