Compile fixes for windows.

This commit is contained in:
Aleric Inglewood
2012-08-10 05:35:11 +02:00
parent b2c5a84964
commit ffb55f482a
4 changed files with 20 additions and 22 deletions

View File

@@ -38,15 +38,6 @@
#include <string>
#if LL_WINDOWS
// On windows, thread-local data is automatically exported.
#define LL_COMMON_API_TLS __declspec(thread)
#define CWD_TLS __declspec(thread)
#else
#define LL_COMMON_API_TLS LL_COMMON_API __thread
#define CWD_TLS __thread
#endif
namespace debug {
namespace libcwd {

View File

@@ -34,8 +34,9 @@
AIThreadID const AIThreadID::sNone(AIThreadID::none);
apr_os_thread_t AIThreadID::sMainThreadID;
apr_os_thread_t const undefinedID = (apr_os_thread_t)-1;
#ifndef LL_DARWIN
apr_os_thread_t ll_thread_local AIThreadID::lCurrentThread = AIThreadID::undefinedID;
apr_os_thread_t CWD_TLS AIThreadID::lCurrentThread;
#endif
void AIThreadID::set_main_thread_id(void)

View File

@@ -33,28 +33,22 @@
#include <apr_portable.h> // apr_os_thread_t, apr_os_thread_current(), apr_os_thread_equal().
#include <iosfwd> // std::ostream.
#include "llpreprocessor.h" // LL_COMMON_API
#include "llpreprocessor.h" // LL_COMMON_API, LL_COMMON_API_TLS
#include "llerror.h"
#if LL_WINDOWS
#define ll_thread_local __declspec(thread)
#else
#define ll_thread_local __thread
#endif
// Lightweight wrapper around apr_os_thread_t.
// This class introduces no extra assembly code after optimization; it's only intend is to provide type-safety.
class LL_COMMON_API AIThreadID
class AIThreadID
{
private:
apr_os_thread_t mID;
static apr_os_thread_t sMainThreadID;
static apr_os_thread_t const undefinedID = (apr_os_thread_t)-1;
static LL_COMMON_API apr_os_thread_t sMainThreadID;
static LL_COMMON_API apr_os_thread_t const undefinedID;
#ifndef LL_DARWIN
static ll_thread_local apr_os_thread_t lCurrentThread;
static LL_COMMON_API_TLS apr_os_thread_t lCurrentThread;
#endif
public:
static AIThreadID const sNone;
static LL_COMMON_API AIThreadID const sNone;
enum undefined_thread_t { none };
enum dout_print_t { DoutPrint };

View File

@@ -195,4 +195,16 @@
# define LL_COMMON_API
#endif // LL_COMMON_LINK_SHARED
// Darwin does not support thread-local data.
#ifndef LL_DARWIN
#if LL_WINDOWS
// On windows, thread-local data is automatically exported.
#define LL_COMMON_API_TLS __declspec(thread)
#define CWD_TLS __declspec(thread)
#else // Linux
#define LL_COMMON_API_TLS LL_COMMON_API __thread
#define CWD_TLS __thread
#endif
#endif
#endif // not LL_LINDEN_PREPROCESSOR_H