chapter 1 code
This commit is contained in:
19
ch1/Makefile
Normal file
19
ch1/Makefile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
CPP = g++-4.8
|
||||||
|
CPPFLAGS = -g -std=c++0x
|
||||||
|
OFLAG = -o
|
||||||
|
.SUFFIXES : .o .cpp .c
|
||||||
|
.cpp.o :
|
||||||
|
$(CPP) $(CPPFLAGS) -c $<
|
||||||
|
.c.o :
|
||||||
|
$(CPP) $(CPPFLAGS) -c $<
|
||||||
|
|
||||||
|
PROGS = hello
|
||||||
|
|
||||||
|
all: $(PROGS)
|
||||||
|
|
||||||
|
hello: hello.o
|
||||||
|
$(CPP) $(OFLAG) hello hello.o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f ${PROGS} *.o
|
||||||
|
|
||||||
18
ch1/hello.cpp
Normal file
18
ch1/hello.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
void hello()
|
||||||
|
{
|
||||||
|
std::cout << "Hello Concurrent World\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
//boost::thread t([]()
|
||||||
|
std::thread t([]()
|
||||||
|
{
|
||||||
|
std::cout << "Hello Concurrent World\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
t.join();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user