Thread Locks Itself

I have a thread that rarely blocks itself. It does:

CriticalSection.Enter

Do Suff

CriticalSection.Leave

However, very rarely while Doing Stuff, the thread will lock itself and not exit like so:

437 RuntimeBackgroundTask (in XojoFramework) + 35 [0xd1cddd] + 437 ??? (in XojoFramework) load address 0xc57000 + 0x1b48b2 [0xe0b8b2] + 437 pthread_mutex_lock (in libsystem_pthread.dylib) + 120 [0x9ca86158] + 437 _pthread_mutex_lock_wait (in libsystem_pthread.dylib) + 99 [0x9ca88c73] + 437 __psynch_mutexwait (in libsystem_kernel.dylib) + 10 [0x96f584da

The thread itself doesn’t wrap back onto any critical sections but it does do a lot of Cocoa Declares.

Any clues?

[quote=223227:@Stephen Dodd]CriticalSection.Enter

Do Suff

CriticalSection.Leave[/quote]
“Suff” in German means binge drinking! It is probably not that easy to leave such a critical section…

Sorry, that I’m not able to help.

[quote=223227:@Stephen Dodd]I have a thread that rarely blocks itself. It does:

CriticalSection.Enter

Do Suff

CriticalSection.Leave

However, very rarely while Doing Stuff, the thread will lock itself and not exit like so:

437 RuntimeBackgroundTask (in XojoFramework) + 35 [0xd1cddd] + 437 ??? (in XojoFramework) load address 0xc57000 + 0x1b48b2 [0xe0b8b2] + 437 pthread_mutex_lock (in libsystem_pthread.dylib) + 120 [0x9ca86158] + 437 _pthread_mutex_lock_wait (in libsystem_pthread.dylib) + 99 [0x9ca88c73] + 437 __psynch_mutexwait (in libsystem_kernel.dylib) + 10 [0x96f584da

The thread itself doesn’t wrap back onto any critical sections but it does do a lot of Cocoa Declares.

Any clues?[/quote]

What do all of the other threads look like when this happens?

The other threads are all blocked by a semaphore including the main. Here’s the log:
http://d.pr/f/1lGaN

That’s a very large number of threads, which are basically starving the rest of the system to the point where it can’t function.

Right. It creates a new thread every 10 seconds or so which should last only a second before releasing. But because the one thread froze, the rest of the threads piled up behind it. So, that explains the app locking up but not necessarily the why the one thread locked.

I don’t know what your thread is doing, but is it always done within ten seconds? Is it possible it took longer?

Well, I suppose it is possible. However I’d assume if that were the case, subsequent threads would wait behind the criticalSection. Of course, if every call to it took over 10 seconds then that would create the problem. Maybe something burped and that happened.