Questions tagged [nsthread]

`NSThread` is part of the Objective-C Foundation Framework and provides developers a way to create and manage threads.

An instance of NSThread controls a thread of execution. Developers can use this class when they would like to perform a series of tasks in its own thread of execution. An example is if the developer wanted to have an Objective-C method run in its own thread of execution.

Threads are useful for long-running tasks that avoid blocking the main thread of the application (where user interface and event-related tasks are handled), as well as dividing a large task into several smaller sub-tasks. This can lead to performance improvements.

In GNUStep, NSThread essentially encapsulates OpenStep threading. Each process starts with a main thread and additonal threads can be created by using NSThread. The GNUStep implementation of OpenStep was designed so that the internals of the base library do not use threading (except in the case of methods that explicitly deal with threads). This makes it possible to write applications without any sort of threading.

References

729 questions
0
votes
1 answer

How to manipulate views while for-loop

I want to manipulate views while in a for loop. I manipulate a view in the for loop, then the operations for the view are done at once after the for loop has ended. I tried to use other threads like GCD, but I noticed that a view is in the main…
morizotter
  • 1,926
  • 2
  • 24
  • 34
0
votes
1 answer

Associating a NSThread with a NSManagedObject

I am creating a NSManagedObject (subclass) with certain attributes. At the same time, I am executing some code/a block that does some network operation given the attributes of my NSManagedObject. Now, some times that network operation might fail or…
user1013725
  • 571
  • 1
  • 4
  • 17
0
votes
1 answer

Possible? NSThread request URL by singleton Objective-C iOS

Situation. XMLProxy Class is singleton. XMLRequest Class too. Normally, when I want to request URL. Example : XMLProxy *xmlProxy = [XMLProxy sharedInstance]; [xmlProxy tryGetDataWithParameter:example_parameter]; // Method "tryGetDataWithParameter"…
ZhOCKeR
  • 3
  • 2
0
votes
2 answers

How to use NSURLConnection inside a dispatch_queue or NSThread or NSOperationQueue?

I have tried using NSURLConnection inside NSThread and dispatch_queue. The implemented NSURLConnectionDelegate methods are not called. But when I used NSOperation inside of NSThread and NSOperationQueue, the methods are called.
0
votes
1 answer

Drawing suspended while processing async NSURLConnection receive data

I'm loading data from a server and processing the response asynchronously. Using NSURLConnection. Each call to the delegate, connection:didReceiveData: is processing that chunk. However, right before a big chunk of data is received, I requested a…
David
  • 2,770
  • 5
  • 35
  • 43
0
votes
2 answers

How to lock a method when using multithreading?

how can I stop 2nd thread to access same method that is being used by first thread?
Dee
  • 1,887
  • 19
  • 47
0
votes
1 answer

How to pass the id of a class instance?

My use case is that I'm trying to start a thread where the destination target object is a class instance. The compiler is giving me an error (Unexpected interface name '': expected expression) when I try to do something like the…
Brett
  • 4,066
  • 8
  • 36
  • 50
0
votes
1 answer

Is this an acceptable idiom for NSThread in Objective-C?

I have a small agent-based modeling-framework that I'm writing as part of a project. The different agents all run in their own threads and a supervisor class controls their lifecycles. So the supervisor class can cancel these threads. I know that…
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
0
votes
1 answer

questions/problems while implementing reusable thread-safe core data pattern

I'm having trouble implementing the thread-safe core data concepts outlined in this tutorial. My goal is to have a reusable portion of code that can take arguments in, do core data operations (adds, updates, deletes) and then callback asynchronously…
Mike S
  • 4,092
  • 5
  • 35
  • 68
0
votes
1 answer

NSThread While Loop Based on Boolean - Music Player Start/Stop - IOS

I am trying to create a music player with start/stop functionality. I do this by starting a while loop that loops if a boolean value is true. This while loop is contained in a separate thread. I start this thread in the viewDidLoad…
rizzes
  • 1,532
  • 20
  • 33
0
votes
2 answers

Difference between NSThread and NSTask

This may sound like noobish question but I have tried researching these two classes and I am not 100% sure what their differences and specific purposes are. Also, is there some way I can retrieve a list of all the currently running processes much…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
0
votes
1 answer

How to use threading for calling a function automatically for each row one after another

It might be silly question but I am not sure how to go with the issue really. I have list of items in uitableview. Each cell has uibutton and URL. When a button is tapped, I start downloading content from server. This works fine as I wanted. Now…
user198725878
  • 6,266
  • 18
  • 77
  • 135
0
votes
1 answer

Dreaded Thread 1 Signal SIGABRT in XCODE V4.4 with Iphone 5.1 Sim

Ok so basically i'm extremely new to this, been doing it about 3 days now. I have been reading through 'IPhone Application Development for Dummies' and have been building a tutorial app. I have just added code to handle view scrolling when the…
Craig
  • 556
  • 1
  • 8
  • 23
0
votes
1 answer

Why not using autorleasepool block does not throw error?

I know that when we use a custom thread to create objects and use them. I tried the below code in an iOS application , it did not throw any error. Why? -(void)Sample{ NSLog(@"Sample"); NSString *temp= @"asdfasdf"; …
RK-
  • 12,099
  • 23
  • 89
  • 155
0
votes
1 answer

About how to use NSThread

I'm an iPhone developer. I studied about how to use NSThread. So I created source code. But, I'm not sure about my source code whether good or bad. -(void)check_threadEnd { if ([_thread isFinished]) { threadCount++; …
hyekyung
  • 671
  • 2
  • 14
  • 27