Project
Loading...
Searching...
No Matches
test_ThreadSanitizer.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
#include <cstdio>
13
#include <string>
14
#include <map>
15
#include <thread>
16
17
using
map_t
= std::map<std::string, std::string>;
18
19
void
*
threadfunc
(
void
* p)
20
{
21
map_t
&
m
= *(
map_t
*)p;
22
m
[
"foo"
] =
"bar"
;
23
return
nullptr
;
24
}
25
26
int
main
()
27
{
28
map_t
m
;
29
// Create a thread in C++11 mode, which executes threadfunc(&m)
30
std::thread thread(
threadfunc
, &
m
);
31
// Start
32
printf(
"foo=%s\n"
,
m
[
"foo"
].c_str());
33
thread.join();
34
}
m
const GLfloat * m
Definition
glcorearb.h:4066
threadfunc
void * threadfunc(void *p)
Definition
test_ThreadSanitizer.cxx:19
map_t
std::map< std::string, std::string > map_t
Definition
test_ThreadSanitizer.cxx:17
main
int main()
Definition
test_ThreadSanitizer.cxx:26
Framework
Foundation
test
test_ThreadSanitizer.cxx
Generated on Tue Feb 25 2025 23:16:41 for Project by
1.9.8