Basic two thread application

This commit is contained in:
Thomas Klaehn 2019-10-27 13:24:19 +01:00
parent cc2432fc27
commit 142e054efc
2 changed files with 23 additions and 2 deletions

View File

@ -21,7 +21,7 @@ CXXFLAGS += -ffunction-sections -fdata-sections
CXXFLAGS += -fno-implicit-inline-templates CXXFLAGS += -fno-implicit-inline-templates
LD_LIBS := -lc -lgcc LD_LIBS := -lc -lgcc -lpthread
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++ CXX = $(CROSS_COMPILE)g++

View File

@ -1,7 +1,28 @@
#include <iostream> #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) { 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; return 0;
} }