1 /*
2 * SimpleThread.hpp
3 *
4 * Copyright (C) 2012 Evidence Srl - www.evidence.eu.com
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef SIMPLETHREAD_HPP_
22 #define SIMPLETHREAD_HPP_
23
24 #ifndef _GNU_SOURCE
26 #endif
27 #include <pthread.h>
28 #include <features.h>
29 #include <vector>
30
32
33 namespace onposix {
34
35 /**
36 * \brief Class for simple thread invocation.
37 *
38 * This class is useful for creating threads that do not return any value.
39 * For more complex cases (e.g., return value), create your own thread by
40 * inheriting from class AbstractThread.
41 *
42 * Example of usage:
43 * \code
44 * void myfunction (void* arg);
45 *
46 * int main ()
47 * {
48 * int b;
49 * SimpleThread t (myfunction, (void*) b);
50 * t.start();
51 * t.waitForTermination();
52 * }
53 * \endcode
54 */
56
59
60 public:
61
66
67 /**
68 * \brief Method run on the new thread
69 *
70 * This method is run on the new thread once start()
71 * is invoked.
72 */
75 }
76 };
77
78 } /* onposix */
79
80 #endif /* SIMPLETHREAD_HPP_ */