annotate src/boost-test.cpp @ 7207:9ed6500e56d3 default tip @

maint: Merge release to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 17 May 2024 20:16:41 +0200
parents 99516e73b368
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2351
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
1 /*
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
2 * This file is part of MXE.
2353
99516e73b368 Move doc/index.html -> index.html
Volker Grabsch <vog@notjusthosting.com>
parents: 2351
diff changeset
3 * See index.html for further information.
2351
8a6c466753e2 Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents: 2333
diff changeset
4 */
900
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
5
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
6 #include <iostream>
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
7 #include <boost/archive/xml_oarchive.hpp>
1335
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
8 #include <boost/thread/thread.hpp>
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
9 #include <boost/thread/tss.hpp>
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
10
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
11 boost::thread_specific_ptr<int> ptr;
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
12
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
13 void test_thread()
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
14 {
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
15 if (ptr.get() == 0) {
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
16 ptr.reset(new int(0));
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
17 }
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
18 std::cout << "Hello, World! from thread" << std::endl;
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
19 }
900
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
20
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
21 int main(int argc, char *argv[])
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
22 {
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
23 (void)argc;
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
24 (void)argv;
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
25
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
26 boost::archive::xml_oarchive oa(std::cout);
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
27 std::string s = "\n\n Hello, World!\n\n";
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
28 oa << BOOST_SERIALIZATION_NVP(s);
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
29
1335
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
30 boost::thread thrd(test_thread);
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
31 thrd.join();
2b7f7e06976b improved test program and portability patches for package boost
Lothar May <lothar.imap@googlemail.com>
parents: 900
diff changeset
32
900
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
33 return 0;
27fc875921a2 add test program for package boost
Volker Grabsch <vog@notjusthosting.com>
parents:
diff changeset
34 }