Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8455113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:12:04+00:00 2026-06-10T12:12:04+00:00

Do you need your property to be Atomic, when using multiple threads and only

  • 0

Do you need your property to be Atomic, when using multiple threads and only getters?

Before I perform a segue, to a given ViewController, I set an instance variable.

That property, will be accessed from multiple threads (Getters only). Here’s the code I’m using. Being executed from my tableView CellForRowAtIndexPath method.

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

    Day *aDay = [[[self days]  objectAtIndex:indexPath.section] objectAtIndex: indexPath.row];

    NSDictionary * data = [OperationsManager workTimeAndAmountForDay: aDay];

    NSString *workTime  = [data objectForKey:@"Work Time"];
    NSString *amount    = [data objectForKey:@"Amount"];

    NSString *textLabel = [NSString stringWithFormat:@"%d - H: %@ $: %@", [[aDay day_] integerValue], workTime, amount];

    dispatch_async(dispatch_get_main_queue(), ^{

        [[cell textLabel] setFont: [UIFont systemFontOfSize: 24.0]];
        [[cell textLabel] setText: textLabel];

        [cell setNeedsLayout];

    });

});

If I do these on one thread only. No GCD. There are NO erros. But if I do this while using GCD, I usually get something like this,

2012-08-30 13:05:52.027 Work Clock[17236:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'statement is still active'
*** First throw call stack:
(0x36a1188f 0x32e28259 0x352c93dd 0x352c8c87 0x3536c951 0x352d8b1f 0x352d0f73 0x35376dd5 0x352e2d1b 0x352e2247 0x352e1d5b 0x352e1c0b 0xc921f 0xc6fed 0x34c7f5cf 0x34c7f55f 0x34c4d495 0x34c42225 0x34c41763 0x34be5f37 0x369701fb 0x32083aa5 0x320836bd 0x32087843 0x3208757f 0x3207f4b9 0x369e5b1b 0x369e3d57 0x369e40b1 0x369674a5 0x3696736d 0x34b2e439 0x34c10cd5 0xbff55 0xbfef0)
terminate called throwing an exception2012-08-30 13:05:52.032 Work Clock[17236:1b03] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x2be320 <x-coredata://E4D2B2E1-B3D9-4358-810B-0FDE7A679A16/Day/p1>''
*** First throw call stack:
(0x36a1188f 0x32e28259 0x352e24f3 0x352e1d5b 0x352e1c0b 0xc95c9 0xc7395 0x37438c59 0x374447bb 0x32f59dfb 0x32f59cd0)
terminate called throwing an exception(lldb) 

I also have this method,

 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

It calls to some of the same properties. Sometimes the error happens there, but I only get Assembly code. I’m unable to replicate the error at this time.

One note,

My call to,

[OperationsManager workTimeAndAmountForDay: aDay];

Is a Class method, defined in my OperationsManager class. It has NO class properties whatsoever.

+(NSDictionary *)workTimeAndAmountForDay:(Day *)aDay;

So, If I’m using only getters when using multiple threads on my VC, and my Class method has no class properties.

Why do I keep getting these errors? Also, they are really hard to replicate! There is some “randomness” feel to it.

Any help is most appreciated!

I could just stop using GCD. And the errors go away. But user experience when
scrolling decreases immensely.

Thank you in advance.

Nuno

Also, these are Core Data objects I’m accessing. Don’t know if that helps? Also only one context. But then again. I’m only reading objects. Not saving or changing the objects state.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:12:06+00:00Added an answer on June 10, 2026 at 12:12 pm

    About atomic, read bbum’s post at:

    http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/

    When you look at the crash, it’s CoreData related. See …

    *** Terminating app due to uncaught exception
    'NSObjectInaccessibleException', reason: 'CoreData
    could not fulfill a fault for '0x2be320
    <x-coredata://E4D2B2E1-B3D9-4358-810B-0FDE7A679A16/Day/p1>''
    

    … how do you access CoreData objects, contexts, … from multiple threads? Did you read this article:

    http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/coredata/Articles/cdConcurrency.html%23//apple_ref/doc/uid/TP40003385-SW1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Reporting Services 2005 and I'm in need of your expertise! I have
I need an ASP.Net control on your property you can specify an array type
I'm using the ShareThis widget. I need to change the url property after the
Suppose you need to perform some kind of comparison amongst 2 files. You only
Need your help to get the max of CAP_PRICE based on certain criteria in
I need your help in JAVA (with some sample code if possible) regarding to
I need your help. I tried to play an audio file stored in Assets
I need your help with display of some comma separated enteries from my database.
I need your help with my script. What I'm trying t do is insert
I need your help with some sample code for a situation I could not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.