Basic two thread application
This commit is contained in:
23
src/main.cc
23
src/main.cc
@@ -1,7 +1,28 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
void *fake_it(void *param)
|
||||
{
|
||||
std::cout << "Hello " << __FUNCTION__ << "\r\n";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *poller(void *param)
|
||||
{
|
||||
std::cout << "Hello " << __FUNCTION__ << "\r\n";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
std::cout << "Hello World!!!" << std::endl;
|
||||
pthread_t it_thread, poll_thread;
|
||||
|
||||
pthread_create(&it_thread, NULL, fake_it, NULL);
|
||||
pthread_create(&poll_thread, NULL, poller, NULL);
|
||||
std::cout << "Hello World!!!" << "\r\n";
|
||||
|
||||
pthread_join(it_thread, NULL);
|
||||
pthread_join(poll_thread, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user