• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
pthread_exit() may only be called against threads created...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pthread_exit() may only be called against threads created...


  • Subject: pthread_exit() may only be called against threads created...
  • From: Steve Gehrman <email@hidden>
  • Date: Mon, 15 Feb 2010 22:23:40 -0800


I'm getting lots of reports of crashes like this:  Anyone have ideas?  Code is below

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  7  Dispatch queue: com.cocoatech.FSEventStreamMgr

Application Specific Information:
/SourceCache/Libc/Libc-583/pthreads/pthread.c:pthread_exit:1786: pthread_exit() may only be called against threads created via pthread_create()

Thread 7 Crashed:  Dispatch queue: com.cocoatech.FSEventStreamMgr
0   libSystem.B.dylib              0x962b0a4e __semwait_signal_nocancel + 10
1   libSystem.B.dylib              0x962b0932 nanosleep$NOCANCEL$UNIX2003 + 166
2   libSystem.B.dylib              0x9632c39a usleep$NOCANCEL$UNIX2003 + 61
3   libSystem.B.dylib              0x9634da50 abort + 105
4   libSystem.B.dylib              0x9634da98 pwrite + 0
5   libSystem.B.dylib              0x9629e7a0 bsearch_b + 0
6   com.apple.Foundation           0x9893e8f8 +[NSThread exit] + 30
7   com.apple.ExceptionHandling    0x962424c5 -[NSExceptionHandler _handleException:mask:] + 1877
8   com.apple.ExceptionHandling    0x96241b36 NSExceptionHandlerUncaughtExceptionHandler + 328
9   com.apple.CoreFoundation       0x914e8519 __raiseError + 681
10  libobjc.A.dylib                0x93e57509 objc_exception_throw + 56
11  com.apple.CoreFoundation       0x91532a21 -[NSException raise] + 17
12  com.apple.ExceptionHandling    0x962424c5 -[NSExceptionHandler _handleException:mask:] + 1877
13  com.apple.ExceptionHandling    0x962419e1 NSExceptionHandlerUncaughtRuntimeErrorHandler + 302
14  libobjc.A.dylib                0x93e5c4ea __objc_error + 52
15  libobjc.A.dylib                0x93e5a7dc _freedHandler + 58
16  com.apple.CoreFoundation       0x91470a62 sendRelease + 34
17  com.cocoatech.cocoatechfile    0x0082bca0 closeFDAsync + 20848
18  libSystem.B.dylib              0x962705c6 _Block_release + 143
19  libSystem.B.dylib              0x9626a1f4 _dispatch_queue_drain + 249
20  libSystem.B.dylib              0x96269c52 _dispatch_queue_invoke + 50
21  libSystem.B.dylib              0x96269a68 _dispatch_worker_thread2 + 234
22  libSystem.B.dylib              0x962694f1 _pthread_wqthread + 390
23  libSystem.B.dylib              0x96269336 start_wqthread + 30



@interface NTDispatchSource ()
@property (nonatomic, assign) id<NTDispatchSourceDelegateProtocol> delegate;
@property (nonatomic, retain) NTFileDesc *desc;
@property (nonatomic, assign) int fd;
@property (nonatomic, assign) dispatch_source_t dispatchSource;
@end

@interface NTDispatchSource(Private)
- (void)closeFile;
- (void)setupDispatchSource;
@end

void closeFDAsync(int theFD, NTFileDesc* theDesc);

@implementation NTDispatchSource

@synthesize fd, dispatchSource;
@synthesize delegate;
@synthesize desc;

+ (NTDispatchSource*)source:(NTFileDesc*)desc delegate:(id<NTDispatchSourceDelegateProtocol>)delegate;
{
NTDispatchSource* result = [[self alloc] init];


result.fd = -1; // initialize as invalid


[result setDelegate:delegate];
[result setDesc:desc];
[result setupDispatchSource];


return [result autorelease];
}

- (void)dealloc
{
if ([self delegate])
[NSException raise:@"must call clearDelegate" format:@"%@", NSStringFromClass([self class])];


    [self setDesc:nil];


[self closeFile];


    [super dealloc];
}

- (void)clearDelegate;
{
// I think I'm being retained by the eventhandler since it can message me
if (self.dispatchSource)
{
dispatch_source_cancel(self.dispatchSource);
dispatch_release(self.dispatchSource);


self.dispatchSource = 0;
}


[self setDelegate:nil];
}

@end

@implementation NTDispatchSource(Private)

- (void)setupDispatchSource;
{
// pipe files hang open (this stuff needs to be in a thread in any case, needs fix)
if (![[self desc] isPipe])
{
self.fd = open([[self desc] fileSystemPath], O_EVTONLY, 0);
if (self.fd != -1)
{
const NSUInteger sourceFlags = (DISPATCH_VNODE_DELETE | DISPATCH_VNODE_WRITE | DISPATCH_VNODE_EXTEND | DISPATCH_VNODE_ATTRIB | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE);  // not including DISPATCH_VNODE_LINK


self.dispatchSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE,
self.fd,
sourceFlags, 
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
if (self.dispatchSource)
{
// Install the event handler to process the name change
dispatch_source_set_event_handler(self.dispatchSource, ^{
// execute on main thread
dispatch_async(dispatch_get_main_queue(), ^{


@try {
[[self delegate] sourceWasModified:self];
}
@catch (NSException * e) {
NSLog(@"setupDispatchSource exception: %@", e);
}
@finally {
}


});
});


// Install a cancellation handler to free the descriptor
// and the stored string.
dispatch_source_set_cancel_handler(self.dispatchSource, ^{
[self closeFile];
});


// Start processing events.
dispatch_resume(self.dispatchSource);
}
else
[self closeFile];
}
}
}

- (void)closeFile;
{
if (self.fd != -1)
{
// getting some main even loop hangs on close.  Not sure why, so added this threaded close method
closeFDAsync(self.fd, [self desc]);


self.fd = -1;
}
}

- (NSString*)description;
{
return [NSString stringWithFormat:@"%@ : %@", NSStringFromClass([self class]), [[self desc] path]];
}

@end

void closeFDAsync(int theFD, NTFileDesc* theDesc)
{
if (theFD != -1)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
@try {
int res = close(theFD);
if (res == -1)
NSLog(@"%@ close failed: %s\n%@", @"closeFDAsync()", strerror(errno), [theDesc path]);
}
@catch (NSException * e) {
NSLog(@"closeFDAsync exception: %@", e);
}
@finally {
}
});
}
}



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Get the underlying cache block size of a filesystem? (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: Get the underlying cache block size of a filesystem?
  • Next by Date: nfs and resource forks
  • Previous by thread: Re: Get the underlying cache block size of a filesystem?
  • Next by thread: How to support advisory posix locks and detect deadlocks?
  • Index(es):
    • Date
    • Thread