Mercurial > mxe-octave
comparison src/boost-test.cpp @ 1335:2b7f7e06976b
improved test program and portability patches for package boost
author | Lothar May <lothar.imap@googlemail.com> |
---|---|
date | Sat, 23 Oct 2010 00:04:16 +0200 |
parents | 27fc875921a2 |
children | f653602a0500 |
comparison
equal
deleted
inserted
replaced
1334:5aa60cef7fd6 | 1335:2b7f7e06976b |
---|---|
1 /* This file is part of mingw-cross-env. */ | 1 /* This file is part of mingw-cross-env. */ |
2 /* See doc/index.html for further information. */ | 2 /* See doc/index.html for further information. */ |
3 | 3 |
4 #include <iostream> | 4 #include <iostream> |
5 #include <boost/archive/xml_oarchive.hpp> | 5 #include <boost/archive/xml_oarchive.hpp> |
6 #include <boost/thread/thread.hpp> | |
7 #include <boost/thread/tss.hpp> | |
8 | |
9 boost::thread_specific_ptr<int> ptr; | |
10 | |
11 void test_thread() | |
12 { | |
13 if (ptr.get() == 0) { | |
14 ptr.reset(new int(0)); | |
15 } | |
16 std::cout << "Hello, World! from thread" << std::endl; | |
17 } | |
6 | 18 |
7 int main(int argc, char *argv[]) | 19 int main(int argc, char *argv[]) |
8 { | 20 { |
9 (void)argc; | 21 (void)argc; |
10 (void)argv; | 22 (void)argv; |
11 | 23 |
12 boost::archive::xml_oarchive oa(std::cout); | 24 boost::archive::xml_oarchive oa(std::cout); |
13 std::string s = "\n\n Hello, World!\n\n"; | 25 std::string s = "\n\n Hello, World!\n\n"; |
14 oa << BOOST_SERIALIZATION_NVP(s); | 26 oa << BOOST_SERIALIZATION_NVP(s); |
15 | 27 |
28 boost::thread thrd(test_thread); | |
29 thrd.join(); | |
30 | |
16 return 0; | 31 return 0; |
17 } | 32 } |