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

Should I be launching an NSTimer in a new thread in this use case

application design/architecture question for a project that I am building. I have a main controller which holds an NSMutableArray of currently "active" objects. Each one of those objects, when instantiated, will have their own NSTimer that is timing…
skålfyfan
  • 4,931
  • 5
  • 41
  • 59
0
votes
1 answer

Problems in thread order execution

I'm developing an app using threading, and something weird is happening. I have these methods: -(void)loadSelectedTest:(int)idTest mustBeSolved:(BOOL)mustBeSolved { NSThread *thread2 = [[NSThread alloc] initWithTarget:self…
NemeSys
  • 555
  • 1
  • 10
  • 28
-1
votes
1 answer

Error when using NSThread

When my app starts for the first time it loads the contents of a plist into a sqlite table. I'm using NSThread to run the process but it's throwing an error once the process has completed. The code I use to call the process and run it is as follows…
user616076
  • 3,907
  • 8
  • 38
  • 64
-1
votes
1 answer

NSTask in NSBundle

I am calculating total number of file on particular path and showing that result in custom cell. I am using NSThread for calculating file count in - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView(inside the bundle) method. when i…
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
-1
votes
1 answer

writing file with NSFileHandle in NSThread crash app

I attempt to write a file in thread because it freeze my app when writing but when i launch writing process it crash 2011-10-04 21:53:51.022 xxxxxxxxx[2046:6603] *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason:…
doc
  • 266
  • 2
  • 15
-1
votes
1 answer

How to wrap a worker NSThread inside of C++ Class

I need to create an NSThread object with a C++ class object passed. The problem is to "exit" this thread from the class the thread operates with. I tried: int threadProc(void* mpClass); struct my_autopool { /// sterge valoarea obiectelor NS definite…
Caty
  • 63
  • 6
-1
votes
3 answers

pass block as parameter in my case

I have a function which takes a block as parameter: typedef void (^ MyBlock)(int); -(void)doTask:(MyBlock)theBlock{ ... } I need to run above function on another thread, I want to use - performSelector:onThread:withObject:waitUntilDone: , my…
Leem.fin
  • 40,781
  • 83
  • 202
  • 354
-1
votes
2 answers

How to Perform a Task Only after a Block of Code in Another Thread Is Completed

Sorry about the confusing title, I have this block of code running in its own thread and want to access a class variable inside another class (view controller) everytime its value changed. To clarify my question here is a simple class structure…
C4DZ
  • 9
  • 2
-1
votes
1 answer

CoreAudio based app stops playing if any UI is added in app

I have a CoreAudio based player that streams remote mp3s. It uses NSURLConnection to retrieve the mp3 data -> uses AudioConverter to convert the stream into PCM -> and feeds the stream into an AUGraph to play audio. The player works completely fine…
3254523
  • 3,016
  • 7
  • 29
  • 43
-1
votes
2 answers

Int Value does not print?

I have created two thread using and static int counter (global variable) ; -(void)ViewDidLoad { [NSThread detachNewThreadSelector:@selector(handleTread:) toTarget:self withObject:nil]; [NSThread…
Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
-1
votes
1 answer

UIActivityIndicatorView not staring

I am trying to set a 'UIActivityIndicatorView' as an accessoryView in one of my 'UITableViewCell', in a such way as, the ActivityIndicator start animating when the user touch this cell. I add the following code at 'didSelectRowAtIndexPath' method:…
-1
votes
1 answer

Pausing the execution of main thread until NSWindow closed

I am newbie in objective-c.I want to pause the execution of main thread until my application keyWindow has been closed.I have tried by following code [mywindow performSelector:@selector(isVisible:) onThread:[NSThread currentThread] withObject:self…
-1
votes
1 answer

How to log number of running thread in an iOS app?

Getting SIGABRT due to big number of threads inside my app. I need to log the number of thread running currently inside my iOS app. I don't want to use profiler and breakpoints stuff.
dev gr
  • 2,409
  • 1
  • 21
  • 33
-1
votes
4 answers

NSThread crash[EXC_BAD_ACCESS]

Below is my code include a thread.This thread take care the queue size,if size > 10 then log and remove the last object.But when I run demo=[[myDemo alloc]init] to start thread,and get exception message="EXC_BAD_ACCESS".Have any guy help me to solve…
luckfox0927
  • 81
  • 1
  • 4
-1
votes
2 answers

how to release my objects in a specific queue?

I created some something in my operation queue(_opQueue), and i want to release them in this queue too. Here is my code, _opQueue was created form "dispatch_queue_create("Data_Serial_Operation_Queue", DISPATCH_QUEUE_SERIAL);" @implementation…
bigjava
  • 145
  • 2
  • 10
1 2 3
48
49