2007-04-20 Mark Rowe <mrowe@apple.com>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2007 07:50:14 +0000 (07:50 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2007 07:50:14 +0000 (07:50 +0000)
        Reviewed by Anders.

        Improve FreeBSD compatibility, as suggested by Alexander Botero-Lowry.

        * kjs/collector.cpp:
        (KJS::currentThreadStackBase): FreeBSD requires that pthread_attr_t's are
        initialized via pthread_attr_init before being used in any context.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20970 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/collector.cpp

index b1a01a5e55a54fa5d42408868337c0a2ee89263d..ec5bb51a494f81fdbc975e4a1144861903e1932a 100644 (file)
@@ -1,3 +1,13 @@
+2007-04-20  Mark Rowe  <mrowe@apple.com>
+
+        Reviewed by Anders.
+
+        Improve FreeBSD compatibility, as suggested by Alexander Botero-Lowry.
+
+        * kjs/collector.cpp:
+        (KJS::currentThreadStackBase): FreeBSD requires that pthread_attr_t's are
+        initialized via pthread_attr_init before being used in any context.
+
 2007-04-19  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Darin.
index 04b48907fb8b6a3748bd66ed5bf5b4df4af9f6a5..92289da91d24f285ebb0abf3fdbc9de83140037b 100644 (file)
@@ -240,6 +240,7 @@ static inline void* currentThreadStackBase()
     pthread_t thread = pthread_self();
     if (stackBase == 0 || thread != stackThread) {
         pthread_attr_t sattr;
+        pthread_attr_init(&sattr);
 #if HAVE(PTHREAD_NP_H)
         // e.g. on FreeBSD 5.4, neundorf@kde.org
         pthread_attr_get_np(thread, &sattr);
@@ -251,6 +252,7 @@ static inline void* currentThreadStackBase()
         int rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);
         (void)rc; // FIXME: deal with error code somehow?  seems fatal...
         ASSERT(stackBase);
+        pthread_attr_destroy(&sattr);
         return (void*)(size_t(stackBase) + stackSize);
         stackThread = thread;
     }