--- ./Headers/GNUstepBase/config.h.in.orig 2013-09-10 16:24:29.000000000 +0900
+++ ./Headers/GNUstepBase/
config.h.in 2014-04-23 18:27:40.000000000 +0900
@@ -817,6 +817,9 @@
/* Define if using the libffi library for invocations */
#undef USE_LIBFFI
+/* Define if using setname functions of pthread */
+#undef PTHREAD_SETNAME
+
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
/usr/ports/lang/gnustep-base/files/patch-Source__NSThread.m
--- ./Source/NSThread.m.orig 2013-08-12 17:56:18.000000000 +0900
+++ ./Source/NSThread.m 2014-04-23 18:33:38.000000000 +0900
@@ -28,7 +28,7 @@
Boston, MA 02111 USA.
<title>NSThread class reference</title>
- $Date: 2013-08-12 09:56:18 +0100 (Mon, 12 Aug 2013) $ $Revision: 36966 $
+ $Date: 2013-08-12 17:56:18 +0900 (Mon, 12 Aug 2013) $ $Revision: 36966 $
*/
#import "common.h"
@@ -93,6 +93,47 @@
#endif
+/*
+ NSThread setName: method for windows
+ */
+#if defined(__MINGW__) && defined(HAVE_WINDOWS_H)
+// Usage: SetThreadName (-1, "MainThread");
+#include <windows.h>
+const DWORD MS_VC_EXCEPTION=0x406D1388;
+
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+ DWORD dwType; // Must be 0x1000.
+ LPCSTR szName; // Pointer to name (in user addr space).
+ DWORD dwThreadID; // Thread ID (-1=caller thread).
+ DWORD dwFlags; // Reserved for future use, must be zero.
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+static void SetThreadName( DWORD dwThreadID, char* threadName)
+{
+ THREADNAME_INFO info;
+ info.dwType = 0x1000;
+ info.szName = threadName;
+ info.dwThreadID = dwThreadID;
+ info.dwFlags = 0;
+
+ __try
+ {
+ RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info );
+ }
+ __except(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+}
+
+#define PTHREAD_SETNAME(a,b) SetThreadName(-1, b)
+
+#endif
+
+
+
// Some older BSD systems used a non-standard range of thread priorities.
// Use these if they exist, otherwise define standard ones.
#ifndef PTHREAD_MAX_PRIORITY
@@ -752,6 +793,14 @@
- (void) setName: (NSString*)aName
{
ASSIGN(_name, aName);
+#ifdef PTHREAD_SETNAME
+ [self performSelector:@selector(setNameOnCurrentThread:) onThread:self withObject:aName waitUntilDone:NO];
+#endif
+}
+
+- (void) setNameOnCurrentThread: (NSString *)aName
+{
+ PTHREAD_SETNAME(pthread_self(), [aName cStringUsingEncoding:NSUTF8StringEncoding]);
}
- (void) setStackSize: (NSUInteger)stackSize
/usr/ports/lang/gnustep-base/files/
patch-configure.ac--- ./configure.ac.orig 2013-11-27 07:55:47.000000000 +0900
+++ ./
configure.ac 2014-04-23 18:27:40.000000000 +0900
@@ -1780,6 +1780,23 @@
CFLAGS=$saved_CFLAGS
#--------------------------------------------------------------------
+# Check if we can name pthreads
+#--------------------------------------------------------------------
+
+AC_CHECK_FUNC(pthread_setname_np, pthread_setname_ok=yes, pthread_setname_ok=no)
+if test $pthread_setname_ok = yes ; then
+ case "$target_os" in
+ darwin*) AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(b), [Description: Define set name function for pthread]);;
+ *) AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_setname_np(a,b), [Description: Define set name function for pthread]);;
+ esac
+fi
+
+AC_CHECK_FUNC(pthread_set_name_np, pthread_set_name_ok=yes, pthread_set_name_ok=no)
+if test $pthread_set_name_ok = yes ; then
+ AC_DEFINE(PTHREAD_SETNAME(a,b), pthread_set_name_np(a,b), [Description: Define set name function for pthread])
+fi
+
+#--------------------------------------------------------------------
# Check whether Objective-C /really/ works
#--------------------------------------------------------------------
AC_MSG_CHECKING(whether objc really works)
And then I added this to the port makefile to have it reconf
post-patch:
cd ${WRKSRC} && /usr/local/bin/autoreconf
Hope this helps..