Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion block is not called #73

Open
cyril94440 opened this issue Dec 23, 2014 · 2 comments
Open

Completion block is not called #73

cyril94440 opened this issue Dec 23, 2014 · 2 comments

Comments

@cyril94440
Copy link

Hey,

I have a problem with the library.
Sometimes the completion block of objectForKey is never called.
It seems that the dispatch_async doesn't work in TMDiskCache.

@cyril94440
Copy link
Author

It seems that everything is working correctly until I reboot the app. Any clue ?

@medvedNick
Copy link

I've encountered the same behavior.

If you look at - (id)objectForKey:(NSString *)key method of TMCache which calls - (void)objectForKey:(NSString *)key block:(TMCacheObjectBlock)block, you'll see that the first method sets dispatch_semaphore_t semaphore which is unlocked in the completion of the second method.

However, not every branch of the second method calls completion block. That causes deadlock on the whole thread.

I am not able to say if it is mistake in my code or in TMCache, but this might be helpful for whoever will be stuck at staring at tons of deadlocked threads in debugger like me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants