Questions tagged [runloop]

A run loop is the concept of running a local loop waiting for a specific event or timeout.

A run loop is the concept of running a local loop waiting for a specific event or timeout.

Such a loop keeps the current thread busy and does not return until the loop has finished, which can either be by a timeout value, an explicit stop signal or if there are no events to process anymore (depends on the specific implementation). Message pumps/loops in applications to process incomming events are typical run loops. But there are other types of local loops (e.g. to make an originally asynchronous process synchronous).

126 questions
4
votes
1 answer

performSegue - does it stop further code execution?

Does the call performSegue supposed to stop further code execution and pass execution to the target? I have this simple call : performSegue(withIdentifier: "showTweets", sender: self) But seems like the following code after that line is still…
Guy Z
  • 683
  • 3
  • 8
  • 24
4
votes
1 answer

Threads that don’t have a runloop

I'm reading Core Animation Programming Guide and in the chapter of "Transactions", I see this Important: When modifying layer properties from threads that don’t have a runloop, you must use explicit transactions. but From Apple's documentation on…
keywind
  • 1,135
  • 14
  • 24
3
votes
1 answer

Difference between CFRunLoopRemoveSource and CFRunLoopSourceInvalidate

I was debugging a crash in my HID driver code on the Mac and found that the crash happened in the CFRunLoop. In the driver code I open the USB handles for the devices which match the VID and the PID which match my HID device and then set up an…
Shivaprasad
3
votes
1 answer

CoreFoundation: Receive/process notifications in background thread

I'm writing a simple application that should be able to receive and process notifications in a background thread using Apple's CoreFoundation framework. Here is what I'm trying to accomplish: static void DummyCallback(CFNotificationCenterRef…
3
votes
1 answer

When autorelease pool release object in background thread?

I know autorelease pool will release objects when the runloop in the state kCFRunLoopBeforeWaiting. So I create a background thread which runloop doesn't run by default. If I use an autorelease pool in this background thread, when does it release…
dowZhang
  • 470
  • 1
  • 3
  • 18
3
votes
1 answer

Why is runloop called when testing

I usually see RunLoop.current.run(until: Date()) called in integration tests. For example in this article and in this open source project. The explanation given in the article is The RunLoop.current.run(until: Date()) statement makes sure the run…
3366784
  • 2,423
  • 1
  • 14
  • 27
3
votes
1 answer

How will UndoManager run loop grouping be affected in different threading contexts?

TLDR: I'm wondering how UndoManager automatic undo grouping based on run loops is effected when using from a background thread, and what my best option is for this. I am using UndoManager (formerly NSUndoManager) in a custom Swift framework with…
Matthew Seaman
  • 7,952
  • 2
  • 37
  • 47
3
votes
1 answer

Simple HID OSX Application

I am getting started with coding for HID devices. I got started with reading Apple documents and sample code. The code provided are terribly outdated that it doesn't even open in Xcode8. Download Sample Code from Apple I need help in finding a…
matt007
  • 304
  • 3
  • 16
3
votes
1 answer

RunLoopObserver and RunLoopActivity

In the code that I show below, I have created a thread that creates random numbers between 0 to 15, and it stops when it comes out 3, changing the end parameter. After I added a run loop observer (that "observe" the end parameter) to the run loop of…
emacos
  • 541
  • 1
  • 8
  • 17
3
votes
0 answers

Ember Run Loop in testing mode

I'm using https://github.com/ride/ember-stripe-service add-on and everything worked nicely until Ember 1.10.1, but since Ember 1.11.0 Ember's run loop start crashing in E2E testing saying that we were trying to access a destroyed object, I have been…
sescob27
  • 647
  • 1
  • 8
  • 17
3
votes
2 answers

How can I find out which run loop a certain NSTimer is on if it was created with scheduledTimerWithTimeInterval?

If I made an NSTimer with scheduledTimerWithTimeInterval, then according to the documentation, it should be added to the current run loop. I'd like to know how to check which run loop an NSTimer is on. Also, if a timer is invalidated and a new one…
Liana
  • 35
  • 6
3
votes
1 answer

When should I apply Runloop to my program and why?

My requirement is that I want to call an API to ask for some new information from my server every 6 seconds,so I wrote my code as below: MyBackgroundThread(){ while(self.isStop){ [self callMyAPI]; [NSThread sleepfortimeinterval…
林鼎棋
  • 1,995
  • 2
  • 16
  • 25
3
votes
3 answers

Running NSTimer on a thread

I am trying to run a NSTimer on a thread using iPhone SDK 3.0. I think I am doing everything correctly (new runloop etc.). If I call [timer invalidate] on viewDidDissappear though I get this error: bool _WebTryThreadLock(bool), 0x3986d60: Tried to…
John
  • 33
  • 1
  • 3
3
votes
1 answer

ALAssetsLibrary doesn't return runloop

i wanna show a UICollectionView but i have a problem with loading the images. The AlAssetsLibrary doesn't return to the runloop. I get the output as 2013-04-12 11:36:25.429 Filmriss[459:907] didReturnWithDefaultRepresentation 2013-04-12…
2
votes
2 answers

Runloop in FoundationTool

I am writing a Foundation Tool. I have to do the threading to separate to different ongoing tasks. I tried to do threading but it was continuously getting crashed. And finally I figured out the reason that, I need to have my own runloop running.…
RLT
  • 4,219
  • 4
  • 37
  • 91
1
2
3
8 9