Basic two thread application
This commit is contained in:
parent
cc2432fc27
commit
142e054efc
2
Makefile
2
Makefile
@ -21,7 +21,7 @@ CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
CXXFLAGS += -fno-implicit-inline-templates
|
||||
|
||||
|
||||
LD_LIBS := -lc -lgcc
|
||||
LD_LIBS := -lc -lgcc -lpthread
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
|
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user