Hullo,

NSNetServices in SVN's -base have a bug with respect to threading, that is, it tries to lock the same lock several times. I originally avoided that problem by using pthread's spin-locks.

For a more portable implementation (I guess), the current version in -base uses GSLazyLocks, which cannot acquire a lock recursively -- as its name implies, NSRecursiveLock can.

The following patch is tested and proven to work.

--- NSNetServices.m.ORG Sun Jan  7 12:06:44 2007
+++ NSNetServices.m     Sun Jan  7 12:15:55 2007
@@ -30,7 +30,9 @@
 #import "Foundation/NSStream.h"
 #import "Foundation/NSTimer.h"
 #import "Foundation/NSValue.h"
-#import "GNUstepBase/GSLock.h"
+#if defined(_REENTRANT)
+#  import "Foundation/NSLock.h"
+#endif

 #import <dns_sd.h>             // Apple's DNS Service Discovery

@@ -78,8 +80,8 @@
         } while(0);

 #if defined(_REENTRANT)
-#  define THE_LOCK             GSLazyLock      *lock
-#  define CREATELOCK(x)                x->lock = [GSLazyLock new]
+#  define THE_LOCK             NSRecursiveLock *lock
+#  define CREATELOCK(x)                x->lock = [NSRecursiveLock new]
 #  define LOCK(x)              [x->lock lock]
 #  define UNLOCK(x)            [x->lock unlock]
 #  define DESTROYLOCK(x)       DESTROY(x->lock)

BTW, NSNetServices are missing in Source/DocMakefile.

--
Chris




_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to