Line | |
---|
1 | // Copyright (C) 2001-2003 |
---|
2 | // William E. Kempf |
---|
3 | // |
---|
4 | // Permission to use, copy, modify, distribute and sell this software |
---|
5 | // and its documentation for any purpose is hereby granted without fee, |
---|
6 | // provided that the above copyright notice appear in all copies and |
---|
7 | // that both that copyright notice and this permission notice appear |
---|
8 | // in supporting documentation. William E. Kempf makes no representations |
---|
9 | // about the suitability of this software for any purpose. |
---|
10 | // It is provided "as is" without express or implied warranty. |
---|
11 | |
---|
12 | #include <boost/thread/thread.hpp> |
---|
13 | #include <iostream> |
---|
14 | |
---|
15 | struct helloworld |
---|
16 | { |
---|
17 | helloworld(const char* who) : m_who(who) { } |
---|
18 | void operator()() |
---|
19 | { |
---|
20 | std::cout << m_who << "says, \"Hello World.\"" << std::endl; |
---|
21 | } |
---|
22 | const char* m_who; |
---|
23 | }; |
---|
24 | |
---|
25 | int main() |
---|
26 | { |
---|
27 | boost::thread thrd(helloworld("Bob")); |
---|
28 | thrd.join(); |
---|
29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.