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
17using map_t = std::map<std::string, std::string>;
18
19void* threadfunc(void* p)
20{
21 map_t& m = *(map_t*)p;
22 m["foo"] = "bar";
23 return nullptr;
24}
25
26int 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}
const GLfloat * m
Definition glcorearb.h:4066
void * threadfunc(void *p)
std::map< std::string, std::string > map_t
int main()