|
|
|||
File indexing completed on 2026-06-02 08:58:14
0001 //////////////////////////////////////////////////////////// 0002 // 0003 // SFML - Simple and Fast Multimedia Library 0004 // Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) 0005 // 0006 // This software is provided 'as-is', without any express or implied warranty. 0007 // In no event will the authors be held liable for any damages arising from the use of this software. 0008 // 0009 // Permission is granted to anyone to use this software for any purpose, 0010 // including commercial applications, and to alter it and redistribute it freely, 0011 // subject to the following restrictions: 0012 // 0013 // 1. The origin of this software must not be misrepresented; 0014 // you must not claim that you wrote the original software. 0015 // If you use this software in a product, an acknowledgment 0016 // in the product documentation would be appreciated but is not required. 0017 // 0018 // 2. Altered source versions must be plainly marked as such, 0019 // and must not be misrepresented as being the original software. 0020 // 0021 // 3. This notice may not be removed or altered from any source distribution. 0022 // 0023 //////////////////////////////////////////////////////////// 0024 0025 #ifndef SFML_THREADLOCAL_HPP 0026 #define SFML_THREADLOCAL_HPP 0027 0028 //////////////////////////////////////////////////////////// 0029 // Headers 0030 //////////////////////////////////////////////////////////// 0031 #include <SFML/System/Export.hpp> 0032 #include <SFML/System/NonCopyable.hpp> 0033 #include <cstdlib> 0034 0035 0036 namespace sf 0037 { 0038 namespace priv 0039 { 0040 class ThreadLocalImpl; 0041 } 0042 0043 //////////////////////////////////////////////////////////// 0044 /// \brief Defines variables with thread-local storage 0045 /// 0046 //////////////////////////////////////////////////////////// 0047 class SFML_SYSTEM_API ThreadLocal : NonCopyable 0048 { 0049 public: 0050 0051 //////////////////////////////////////////////////////////// 0052 /// \brief Default constructor 0053 /// 0054 /// \param value Optional value to initialize the variable 0055 /// 0056 //////////////////////////////////////////////////////////// 0057 ThreadLocal(void* value = NULL); 0058 0059 //////////////////////////////////////////////////////////// 0060 /// \brief Destructor 0061 /// 0062 //////////////////////////////////////////////////////////// 0063 ~ThreadLocal(); 0064 0065 //////////////////////////////////////////////////////////// 0066 /// \brief Set the thread-specific value of the variable 0067 /// 0068 /// \param value Value of the variable for the current thread 0069 /// 0070 //////////////////////////////////////////////////////////// 0071 void setValue(void* value); 0072 0073 //////////////////////////////////////////////////////////// 0074 /// \brief Retrieve the thread-specific value of the variable 0075 /// 0076 /// \return Value of the variable for the current thread 0077 /// 0078 //////////////////////////////////////////////////////////// 0079 void* getValue() const; 0080 0081 private: 0082 0083 //////////////////////////////////////////////////////////// 0084 // Member data 0085 //////////////////////////////////////////////////////////// 0086 priv::ThreadLocalImpl* m_impl; //!< Pointer to the OS specific implementation 0087 }; 0088 0089 } // namespace sf 0090 0091 0092 #endif // SFML_THREADLOCAL_HPP 0093 0094 0095 //////////////////////////////////////////////////////////// 0096 /// \class sf::ThreadLocal 0097 /// \ingroup system 0098 /// 0099 /// This class manipulates void* parameters and thus is not 0100 /// appropriate for strongly-typed variables. You should rather 0101 /// use the sf::ThreadLocalPtr template class. 0102 /// 0103 ////////////////////////////////////////////////////////////
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|