Lunchbox  1.13.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
threadID.h
1 
2 /* Copyright (c) 2010-2015, Stefan Eilemann <eile@eyescale.ch>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef LUNCHBOX_THREADID_H
20 #define LUNCHBOX_THREADID_H
21 
22 #include <lunchbox/api.h> // LUNCHBOX_API definition
23 #include <lunchbox/compiler.h>
24 
25 #include <ostream>
26 
27 namespace lunchbox
28 {
29 namespace detail { class ThreadID; }
30 
32 class ThreadID
33 {
34 public:
36  LUNCHBOX_API ThreadID();
37 
39  LUNCHBOX_API ThreadID( const ThreadID& from );
40 
42  LUNCHBOX_API ~ThreadID();
43 
45  LUNCHBOX_API ThreadID& operator = ( const ThreadID& from );
46 
48  LUNCHBOX_API bool operator == ( const ThreadID& rhs ) const;
49 
54  LUNCHBOX_API bool operator != ( const ThreadID& rhs ) const;
55 
57  bool operator < ( const ThreadID& rhs ) const;
58 
59 private:
60  detail::ThreadID* const _impl;
61  friend class Thread;
62 
63  friend LUNCHBOX_API
64  std::ostream& operator << ( std::ostream& os, const ThreadID& );
65 };
66 
68 LUNCHBOX_API std::ostream& operator << ( std::ostream&, const ThreadID& );
69 }
70 #endif // LUNCHBOX_THREADID_H
ThreadID & operator=(const ThreadID &from)
Assign another thread identifier.
friend std::ostream & operator<<(std::ostream &os, const ThreadID &)
Print the thread to the given output stream.
Defines export visibility macros for library Lunchbox.
Utility class to execute code in a separate execution thread.
Definition: thread.h:41
An utility class to wrap OS-specific thread identifiers.
Definition: threadID.h:32
~ThreadID()
Destruct this thread identifier.
bool operator!=(const ThreadID &rhs) const
bool operator==(const ThreadID &rhs) const
ThreadID()
Construct a new, zero thread identifier.
Abstraction layer and common utilities for multi-threaded programming.
Definition: algorithm.h:32
std::ostream & operator<<(std::ostream &os, const Array< T > &array)
Pretty-print all members of the array.
Definition: array.h:47