Loading...
Searching...
No Matches
threads.h
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_BASE_TRACE_THREADS_H
9#define PXR_BASE_TRACE_THREADS_H
10
11#include "pxr/pxr.h"
12#include "pxr/base/trace/api.h"
13
14#include <string>
15
16PXR_NAMESPACE_OPEN_SCOPE
17
24public:
28 TRACE_API TraceThreadId();
29
31 TRACE_API explicit TraceThreadId(const std::string& id);
32
34 const std::string& ToString() const { return _id; }
35
37 TRACE_API bool operator==(const TraceThreadId&) const;
38
40 TRACE_API bool operator<(const TraceThreadId&) const;
41private:
42 std::string _id;
43};
44
45inline TraceThreadId TraceGetThreadId() {
46 return TraceThreadId();
47}
48
49PXR_NAMESPACE_CLOSE_SCOPE
50
51#endif // PXR_BASE_TRACE_THREADS_H
This class represents an identifier for a thread.
Definition: threads.h:23
TRACE_API TraceThreadId()
Constructor which creates an identifier based on std::thread_id.
TRACE_API bool operator<(const TraceThreadId &) const
Less than operator.
const std::string & ToString() const
Returns the string representation of the id.
Definition: threads.h:34
TRACE_API bool operator==(const TraceThreadId &) const
Equality operator.
TRACE_API TraceThreadId(const std::string &id)
Constructor which creates an identifier from id.