diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-02-23 09:58:44 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-02-23 09:58:44 +0100 |
commit | 4dcc14fa7e853546d68a48cd9d5f81b69c25bc1f (patch) | |
tree | 58f8531af5e54784fca54c72d414e144b5e18373 /sal/osl | |
parent | fb4f853ff6e53f3537e8e5ff2b488d039d175a16 (diff) | |
parent | ea713649e558dcec291302bffd00b148a96e33a8 (diff) |
debuglevels: merged to-be-m101
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/os2/thread.c | 4 | ||||
-rw-r--r-- | sal/osl/unx/pipe.c | 2 | ||||
-rw-r--r-- | sal/osl/unx/thread.c | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | sal/osl/w32/thread.c | 25 |
4 files changed, 46 insertions, 1 deletions
diff --git a/sal/osl/os2/thread.c b/sal/osl/os2/thread.c index 313e67c0f925..0f0c396a407c 100644 --- a/sal/osl/os2/thread.c +++ b/sal/osl/os2/thread.c @@ -549,6 +549,10 @@ void SAL_CALL osl_yieldThread() DosSleep(0); } +void osl_setThreadName(char const * name) { + (void) name; +} + typedef struct _TLS { PULONG pulPtr; diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index ede4cd7e074f..069ea9990951 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -486,7 +486,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, (sal_Char*)pBuffer, BytesToRead, 0); - if ( nRet <= 0 ) + if ( nRet < 0 ) { OSL_TRACE("osl_receivePipe failed : %i '%s'",nRet,strerror(errno)); } diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index fe53915b792f..18c4b033daf7 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -34,6 +34,10 @@ #include <rtl/textenc.h> #endif +#if defined LINUX +#include <sys/prctl.h> +#endif + /**************************************************************************** * @@@ TODO @@@ * @@ -566,6 +570,18 @@ void SAL_CALL osl_yieldThread() sched_yield(); } +void SAL_CALL osl_setThreadName(char const * name) { +#if defined LINUX + if (prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0) != 0) { + OSL_TRACE( + "%s prctl(PR_SET_NAME) failed with errno %d", OSL_LOG_PREFIX, + errno); + } +#else + (void) name; +#endif +} + /*****************************************************************************/ /* osl_getThreadIdentifier @@@ see TODO @@@ */ /*****************************************************************************/ diff --git a/sal/osl/w32/thread.c b/sal/osl/w32/thread.c index 88ce87cdf175..8d85c8867b2d 100644..100755 --- a/sal/osl/w32/thread.c +++ b/sal/osl/w32/thread.c @@ -394,6 +394,31 @@ void SAL_CALL osl_yieldThread(void) Sleep(0); } +void SAL_CALL osl_setThreadName(char const * name) { +#ifdef _MSC_VER + /* See <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>: */ +#pragma pack(push, 8) + struct { + DWORD dwType; + LPCSTR szName; + DWORD dwThreadID; + DWORD dwFlags; + } info; +#pragma pack(pop) + info.dwType = 0x1000; + info.szName = name; + info.dwThreadID = (DWORD) -1; + info.dwFlags = 0; + __try { + RaiseException( + 0x406D1388, 0, sizeof info / sizeof (ULONG_PTR), + (ULONG_PTR *) &info); + } __except (EXCEPTION_EXECUTE_HANDLER) {} +#else + (void) name; +#endif +} + typedef struct _TLS { DWORD dwIndex; |