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 7925801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:27:53+00:00 2026-06-03T18:27:53+00:00

While writing an app, I encountered some odd behavior that I wasn’t expecting and

  • 0

While writing an app, I encountered some odd behavior that I wasn’t expecting and distilled it down to the following:

I made an app whose main function is as follows. While observing it in Activity Monitor, it uses one thread.

int main(int argc, const char * argv[])
{
    @autoreleasepool
    {
        while (YES)
        {
            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
                                     beforeDate:[NSDate distantFuture]];
        }
    }

    return 0;
}

If I change [NSDate distantFuture] to [NSDate dateWithTimeIntervalSinceNow:1.0], the app uses ~3 threads. After inspecting this a bit it appears that a dispatch_queue has been implicitly created on my behalf which in turn makes a thread pool.

Just curious: why does this happen? What about [NSDate dateWithTimeIntervalSinceNow:1.0] causes the run loop to create a dispatch_queue?

  • 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-03T18:27:54+00:00Added an answer on June 3, 2026 at 6:27 pm

    Most likely, an implementation detail and nothing to worry about….

    One possibly implementation of distantFuture is “do it forever” and, therefore, no need for a timer like the one w/a specific date. Given that “timer” might actually be dispatch_after(), that might explain the queue.

    Or not. Interesting question, but likely quite thoroughly irrelevant to your app.

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

Sidebar

Related Questions

I am writing an app and having some doubt while doing it. I save
I'm writing an iPhone app that's using Facebook Connect. While testing, you normally embed
While writing some C code, I decided to compile it to assembly and read
While writing code in a file that would comprise of PHP, HTML, CSS &
While writing a card shuffling algorithm I realized that there are 52! ~= 2^225
While writing some views to respond to ajax requests i find it somewhat strange
Sometimes while writing Java in Eclipse, I write code that generates warnings. A common
I'm using coffeescript while writing a node js app and use cake watch to
I'm writing an app with a feature that will let the user choose from
I am currently writing an app in python that needs to generate large amount

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.