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

  • Home
  • SEARCH
  • 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 4087502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:51:48+00:00 2026-05-20T18:51:48+00:00

What is the differences between these two? [NSThread detachNewThreadSelector:@selector(method) toTarget:self withObject:nil]; [self performSelectorInBackground:@selector(method) withObject:nil];

  • 0

What is the differences between these two?

 [NSThread detachNewThreadSelector:@selector(method) toTarget:self withObject:nil];
 [self performSelectorInBackground:@selector(method) withObject:nil];

I normally use the second method to spawn a new thread.
But I was wondering if I call this twice like shown below in a method then what is going to happen? Also If I have a tabmenu and each menu spawns a thread then which one I should use?

 [self performSelectorInBackground:@selector(method1) withObject:nil];
 [self performSelectorInBackground:@selector(method2) withObject:nil];
  • 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-05-20T18:51:49+00:00Added an answer on May 20, 2026 at 6:51 pm

    They are identical. Here is the what the official documentation has to say on this topic:

    In
    iOS and Mac OS X v10.5 and later, all
    objects have the ability to spawn a
    new thread and use it to execute one
    of their methods. The
    performSelectorInBackground:withObject:
    method creates a new detached thread
    and uses the specified method as the
    entry point for the new thread. For
    example, if you have some object
    (represented by the variable myObj)
    and that object has a method called
    doSomething that you want to run in a
    background thread, you could could use
    the following code to do that:

    [myObj
    performSelectorInBackground:@selector(doSomething)
    withObject:nil];

    The effect of calling
    this method is the same as if you
    called the
    detachNewThreadSelector:toTarget:withObject:
    method of NSThread with the current
    object, selector, and parameter object
    as parameters. The new thread is
    spawned immediately using the default
    configuration and begins running.
    Inside the selector, you must
    configure the thread just as you would
    any thread. For example, you would
    need to set up an autorelease pool (if
    you were not using garbage collection)
    and configure the thread’s run loop if
    you planned to use it. For information
    on how to configure new threads, see
    “Configuring Thread Attributes.”

    As for what happens if you do:

    [self performSelectorInBackground:@selector(method1) withObject:nil];
    [self performSelectorInBackground:@selector(method2) withObject:nil];
    

    …you will spawn two new threads, one of which starts executing at method1 and one of which starts executing at method2. The threads may execute concurrently (i.e. the second one will not wait for the first one to terminate before it starts executing).

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

Sidebar

Related Questions

What are the differences between these two, and which one should I use? string
The question is self-explanatory. What are the differences between these two?
What are the differences between these two codes in JavaScript? var obj = new
Can you help me understand the practical differences between these two; IList<int> myList =
There are a number of run-time differences in compatible code between these two versions
I am not able to find actual differences between these two Java EE servers.
When revealing a new view, what are the differences between these two and when
I would like to know the differences between these two types of URLs: relative
I am confused on the differences between these two code blocks: $(#someButton).click(function() { var
Are there any differences between these two covered indexes? A composite index with both

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.