CoreData Application Freezes while performing a fetch Request pthread_mutex_lock
===

I am using Core Data for managing data base into my app. 

I can not post the code here, because its too lengthy. But I guess that I can explain my problem in small line of code along with some snap shots. 


    +(NSArray *)checkusernameandpassword:(NSString *)entityname  username:(NSString *)username   password:(NSString *)password 
    {
    	managedobjectcontext=[Singleton sharedmysingleton].managedobjectcontext;
    	NSEntityDescription *entity=[NSEntityDescription entityForName:entityname inManagedObjectContext:managedobjectcontext];
        
        NSFetchRequest *request=[[NSFetchRequest alloc] init];
    	[request setEntity:entity];
        
        NSPredicate *predicates=[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"userName==\"%@\" AND password==\"%@\"",username,password]];
    	[request setPredicate:predicates];	
        //On Below line, My app frezes and goes into deadlock, this happens randomly while performing
        //some data request using Core data
    	NSArray *arrayofrecord=[managedobjectcontext executeFetchRequest:request error:nil];    
    	
    	return arrayofrecord;
    }

I am trying to attach some screen shots of the stack of calls (These I see when I pause my app)
**The method with a checkmark in the image,at which deadlock occur is mentioned above**
![The method with a checkmark in the image,at which deadlock occur is mentioned above][1]


  [1]: http://i.stack.imgur.com/qWPhk.png
