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
-1
votes
2 answers

pass multiple arguments in sector with NSthread in objective c

I want to pass two arguments to method with NSThread. I tried using this third answer. But unfortunatlly that code was not working well because andKeys: method is not available. [NSThread…
Himesh
  • 458
  • 1
  • 3
  • 15
-1
votes
1 answer

Painting a UIView from a background NSThread?

I am developing GL paint application. To paint any object, I am using UIView that implemented. Starting paint method : - (void)viewDidLoad { .... [NSThread detachNewThreadSelector:@selector(paintingObjects) …
Ferdinand
  • 1,193
  • 4
  • 23
  • 43
-1
votes
1 answer

how to cancel previous block by the coming block in GCD?

Possible Duplicate: How do I kill/suspend/close an asyncronous block in GCD? I am working on an app that does image processing and displays the resulting image. Im using UIScrollView to let user scroll all images, because the image is not a…
chancyWu
  • 14,073
  • 11
  • 62
  • 81
-1
votes
1 answer

How to notify the background thread from the main thread when there is something needs to be processed

I am working on an app that does image processing and displays the resulting image. Im using UIScrollView to let user scroll all images, because the image is not a standard jpg or png, it takes time to load. so i want to use a thread to load image,…
chancyWu
  • 14,073
  • 11
  • 62
  • 81
-1
votes
1 answer

How to close UDP socket blocked on rcvfrom

I'm doing application for iPhone using C sockets. At some point I'm performing recvfrom on separate NSThread (which is blocking) and I dont know how to force this operation to "unblock" and exit from thread gracefully. Calling shutdown() or close()…
solgar
  • 4,312
  • 2
  • 26
  • 30
-2
votes
3 answers

How to confirm that a method will execute under main thread in objective C?

I have a method say someMethod(), I always want this method should be executed under main thread. So I wrote this method like this.. -(void)someMethod { if([NSThread mainThread]) { // Do method stuffs } else { [self…
Confused
  • 3,846
  • 7
  • 45
  • 72
-2
votes
1 answer

Send NSDictionary as an parameter in @selector

How can I send my NSDictionary on my selector, as a parameter, and how I can read it? NSDictionary * dict = [[NSDictionary alloc]initWithObjectsAndKeys:@"idOferta",@"test", nil]; NSThread * viewsThread = [[NSThread alloc]…
darkman
  • 993
  • 3
  • 13
  • 31
-2
votes
1 answer

NStimer from NSThread

iphone project. How can i call NStimer from NSThread? I tried with no luck.
Shay
  • 2,595
  • 3
  • 25
  • 35
-3
votes
2 answers

Autoreleasepool for separate threads in iOS

Possible Duplicate: Does every thread need its own autorelease pool? I would like to know why it is required to use autorelease pool, when we call some methods on a separate thread rather than the main thread, please clarify.
karthick
  • 351
  • 1
  • 5
  • 18
1 2 3
48
49