Ticket #4484: main.cpp

File main.cpp, 549 bytes (added by sh, 12 years ago)
Line 
1/*
2 * File: main.cpp
3 * Author: eshubin
4 *
5 * Created on 28 Июль 2010 г., 13:21
6 */
7
8#include <boost/thread.hpp>
9#include <cstdlib>
10
11using namespace std;
12
13void ThreadFun(int number)
14{
15 sleep(5);
16}
17
18int main(int argc, char** argv)
19{
20 if (argc > 1)
21 {
22 pid_t pid = fork();
23 if (pid < 0)
24 {
25 return EXIT_FAILURE;
26 }
27 else if (pid > 0)
28 {
29 return EXIT_SUCCESS;
30 }
31 }
32 boost::thread th1(boost::bind(&ThreadFun, 1));
33 th1.join();
34 return EXIT_SUCCESS;
35}
36