-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
63 lines (42 loc) · 1.35 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "SignalHandler.hpp"
//#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
// #include <boost/log/expressions.hpp>
// #include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
// #include <boost/log/utility/setup/common_attributes.hpp>
// #include <boost/log/sources/severity_logger.hpp>
// #include <boost/log/sources/record_ostream.hpp>
#include <unistd.h>
namespace KDetTestArea
{
class RedShirt
{
public:
RedShirt(){BOOST_LOG_TRIVIAL(trace) << this << " has been constructed!";};
virtual ~RedShirt(){
static const char msg[] = "SIGCHLD Recieved\n";
write(STDERR_FILENO, msg, strlen(msg));
};
};
};
int main(int argumentCount, char **argumentVector)
{
// setup logging
boost::log::add_file_log("sample.log");
//start signal handler
KDetTestArea::signalBlockingHandler daHandler;
// daHandler.wait();// I guess this is a degenerate test of the handler construction
//spawn my threads
static KDetTestArea::RedShirt gonnaDieAtWeirdTimes;
KDetTestArea::RedShirt mightLive;
//detach from console
pid_t processId = fork();
if(0 != processId) {
quick_exit(EXIT_SUCCESS);
}
daHandler.wait();// I guess this is a degenerate test of the handler construction
//never reached with call to exit()
BOOST_LOG_TRIVIAL(trace) << "WTF";
return EXIT_FAILURE;
}