//@cond none
namespace cds { namespace OS {
- namespace libc {
+ CDS_CXX11_INLINE_NAMESPACE namespace libc {
/// Allocates memory on a specified alignment boundary
static inline void * aligned_malloc(
size_t nSize, ///< Size of the requested memory allocation
}
} // namespace libc
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
using libc::aligned_malloc;
using libc::aligned_free;
+#endif
}} // namespace cds::OS
//@endcond
//@cond none
namespace cds { namespace OS {
- namespace posix {
+ CDS_CXX11_INLINE_NAMESPACE namespace posix {
/// Allocates memory on a specified alignment boundary
static inline void * aligned_malloc(
size_t nSize, ///< Size of the requested memory allocation
}
} // namespace posix
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
using posix::aligned_malloc;
using posix::aligned_free;
+#endif
}} // namespace cds::OS
//@endcond
#include <unistd.h>
namespace cds { namespace OS {
- namespace posix {
+ CDS_CXX11_INLINE_NAMESPACE namespace posix {
/// Fake system topology
struct topology {
/// Logical processor count for the system. Always returns 1
};
} // namespace posix
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
using posix::topology;
+#endif
+
}} // namespace cds::OS
#endif // #ifndef __CDS_OS_POSIX_FAKE_TOPOLOGY_H
+++ /dev/null
-//$$CDS-header$$
-
-#ifndef __CDS_OS_POSIX_SYSERROR_H
-#define __CDS_OS_POSIX_SYSERROR_H
-
-#include <stdlib.h> // system
-#include <pthread.h>
-#include <sched.h>
-#include <cerrno>
-#include <cstdlib>
-#include <string>
-#include <string.h>
-
-namespace cds { namespace OS {
- namespace posix {
- /// Posix error code type
- typedef int error_code;
-
- /// Get text for system error \p nCode
- static inline std::string getSystemErrorText( error_code nCode )
- {
- char *msg = strerror( nCode );
- return std::string( msg );
- }
-
- /// Get curent error code (returns \p errno)
- static inline error_code getErrorCode()
- {
- return errno;
- }
-
- } // namespace posix
-
- using posix::error_code;
- using posix::getErrorCode;
- using posix::getSystemErrorText;
-}} // namespace cds::OS
-
-
-#endif // #ifndef __CDS_OS_POSIX_SYSERROR_H
namespace cds { namespace OS {
/// posix-related wrappers
- namespace posix {
+ CDS_CXX11_INLINE_NAMESPACE namespace posix {
/// Posix thread id type
typedef std::thread::native_handle_type ThreadId;
}
} // namespace posix
- //@cond
+ constexpr const posix::ThreadId c_NullThreadId = 0;
+
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
using posix::ThreadId;
- constexpr const ThreadId c_NullThreadId = 0;
using posix::getCurrentThreadId;
using posix::isThreadAlive;
- //@endcond
+#endif
}} // namespace cds::OS
//@cond none
namespace cds { namespace OS {
- namespace posix {
+ CDS_CXX11_INLINE_NAMESPACE namespace posix {
// High resolution timer
// From Linux as an example
};
} // namespace posix
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
using posix::Timer;
+#endif
}} // namespace cds::OS
//@endcond
//@cond none
namespace cds { namespace OS {
- namespace Win32 {
+ CDS_CXX11_INLINE_NAMESPACE namespace Win32 {
/// Allocates memory on a specified alignment boundary
static inline void * aligned_malloc(
size_t nSize, ///< Size of the requested memory allocation
}
} // namespace Win32
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
using Win32::aligned_malloc;
using Win32::aligned_free;
+#endif
}} // namespace cds::OS
//@endcond
+++ /dev/null
-//$$CDS-header$$
-
-#ifndef __CDS_OS_WIN_SYSERROR_H
-#define __CDS_OS_WIN_SYSERROR_H
-
-#include <windows.h>
-#include <string>
-
-namespace cds { namespace OS {
- namespace Win32 {
-
- /// OS-specific type of error code
- typedef DWORD error_code;
-
- /// Get system error code
- static inline error_code getErrorCode()
- {
- return ::GetLastError();
- }
-
- /// Get system error text
- static inline std::string getSystemErrorText( error_code nCode )
- {
- char *ptmp = 0;
- if ( !FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- nullptr,
- nCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &ptmp, 0, 0 )
- )
- {
- if ( ptmp )
- LocalFree( ptmp );
- return std::string();
- }
- std::string str( ptmp );
- LocalFree( ptmp );
- return str;
- }
- } // namespace Win32
-
- using Win32::error_code;
- using Win32::getErrorCode;
- using Win32::getSystemErrorText;
-}} // namespace cds::OS
-
-#endif // #ifndef __CDS_OS_WIN_SYSERROR_H
-
namespace cds { namespace OS {
/// Windows-specific functions
- namespace Win32 {
+ CDS_CXX11_INLINE_NAMESPACE namespace Win32 {
/// OS-specific type of thread identifier
typedef DWORD ThreadId;
} // namespace Win32
//@cond
- using Win32::ThreadId;
- CDS_CONSTEXPR const ThreadId c_NullThreadId = 0;
+ CDS_CONSTEXPR const Win32::ThreadId c_NullThreadId = 0;
+#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
+ using Win32::ThreadId;
using Win32::getCurrentThreadId;
using Win32::isThreadAlive;
+#endif
//@endcond
}} // namespace cds::OS
<ClInclude Include="..\..\..\cds\os\linux\timer.h" />\r
<ClInclude Include="..\..\..\cds\os\linux\topology.h" />\r
<ClInclude Include="..\..\..\cds\os\posix\alloc_aligned.h" />\r
- <ClInclude Include="..\..\..\cds\os\posix\syserror.h" />\r
<ClInclude Include="..\..\..\cds\os\posix\thread.h" />\r
<ClInclude Include="..\..\..\cds\os\sunos\alloc_aligned.h" />\r
<ClInclude Include="..\..\..\cds\os\sunos\timer.h" />\r
<ClInclude Include="..\..\..\cds\os\sunos\topology.h" />\r
<ClInclude Include="..\..\..\cds\os\win\alloc_aligned.h" />\r
- <ClInclude Include="..\..\..\cds\os\win\syserror.h" />\r
<ClInclude Include="..\..\..\cds\os\win\thread.h" />\r
<ClInclude Include="..\..\..\cds\os\win\timer.h" />\r
<ClInclude Include="..\..\..\cds\os\win\topology.h" />\r
<ClInclude Include="..\..\..\cds\os\posix\alloc_aligned.h">\r
<Filter>Header Files\cds\OS\posix</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\cds\os\posix\syserror.h">\r
- <Filter>Header Files\cds\OS\posix</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\..\cds\os\posix\thread.h">\r
<Filter>Header Files\cds\OS\posix</Filter>\r
</ClInclude>\r
<ClInclude Include="..\..\..\cds\os\win\alloc_aligned.h">\r
<Filter>Header Files\cds\OS\win</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\cds\os\win\syserror.h">\r
- <Filter>Header Files\cds\OS\win</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\..\cds\os\win\thread.h">\r
<Filter>Header Files\cds\OS\win</Filter>\r
</ClInclude>\r
<ItemGroup>\r
<ClCompile Include="..\..\..\tests\unit\ellen_bintree_update_desc_pool.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\michael_alloc.cpp" />\r
- <ClCompile Include="..\..\..\tests\cppunit\test_main.cpp" />\r
+ <ClCompile Include="..\..\..\tests\cppunit\test_main.cpp">\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ICL-Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='ICL-Debug|x64'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
<ClCompile Include="..\..\..\tests\cppunit\thread.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
---------------------------------\r
\r
GCC: 4.8 and above\r
-MS Visual C++: 12 (2013) and above\r
+MS Visual C++: 12 (2013) Update 4 and above\r
Clang: 3.3 and above\r
\r
How to build\r