Re: Inserting a task into the run loop

2015-03-26 Thread Frank D. Engel, Jr.
I think you might be able to use this: [object performSelectorOnMainThread:(SEL)aSelector withObject:nil waitUntilDone:NO]; If I am interpreting the behavior of that call correctly, you would need to call that once to get it started, then at the

Re: Inserting a task into the run loop

2015-03-22 Thread Roland King
> On 23 Mar 2015, at 13:05, Graham Cox wrote: > > >> On 23 Mar 2015, at 12:47 pm, Graham Cox wrote: >> >> But what actual form would a task take that said "loop as many times as >> necessary until there's no more to do, then finish"? > > > Just to clarify, as re-reading this it isn't clea

Re: Inserting a task into the run loop

2015-03-22 Thread Graham Cox
> On 23 Mar 2015, at 12:47 pm, Graham Cox wrote: > > But what actual form would a task take that said "loop as many times as > necessary until there's no more to do, then finish"? Just to clarify, as re-reading this it isn't clear what I really mean: I mean a task that will loop on each tur

Re: Inserting a task into the run loop

2015-03-22 Thread Graham Cox
> On 23 Mar 2015, at 12:00 pm, Roland King wrote: > > [] > When you have reached the state that there are no more flags set and no more > changes to propagate, and so the ‘root’ flag is unset, what apart from a user > action would cause changes to start again? There are periodic devices suc

Re: Inserting a task into the run loop

2015-03-22 Thread Kyle Sluder
On Sun, Mar 22, 2015, at 07:00 PM, Roland King wrote: > I assume by the way that none of the available libraries for circuit > simulation do what you want. There’s quite a few of them out there, SPICE > and Tina come to mind but every time I’ve looked I’ve found quite a few. I was going to menti

Re: Inserting a task into the run loop

2015-03-22 Thread Quincey Morris
On Mar 22, 2015, at 16:28 , Graham Cox wrote: > > Each cycle of the loop it looks at whether any state of any "device" has > changed and propagates the change. What I don’t understand is what this has got to do with run loops at all. You want to poll some state often, I suppose you can do it

Re: Inserting a task into the run loop

2015-03-22 Thread Roland King
> On 23 Mar 2015, at 07:28, Graham Cox wrote: > > >> On 23 Mar 2015, at 9:52 am, Ken Thomases wrote: >> >> I'd be curious to know how "run all the time", "run as often as possible", >> and "an endless loop" jibe with "not heavyweight processing" and "isn't >> going to be a huge drain on any

Re: Inserting a task into the run loop

2015-03-22 Thread Gary L. Wade
This all depends on how deep your simulation is, but devices are rarely so synchronous in operation, and I'd run a "device" on a separate thread to simulate its independent nature, and have its operation changes posted to an appropriate queue, such as the main one. If the main queue needs to com

Re: Inserting a task into the run loop

2015-03-22 Thread Uli Kusterer
On 23 Mar 2015, at 00:28, Graham Cox wrote: > I believe I want my simulation to run "as fast as possible" but because in an > idle state a given circuit may simply sit there doing nothing it shouldn't be > burning up a lot of processing time as such. That sounds like you want an NSTimer with a

Re: Inserting a task into the run loop

2015-03-22 Thread Uli Kusterer
On 22 Mar 2015, at 05:27, Graham Cox wrote: > I've never had call to do this before, so I'm not sure what I should be doing > here. Override NSApplication sendEvent: or nextEventMatchingMask: depending on your exact requirements? I’d be curious if there’s a better way, too. What are you doing

Re: Inserting a task into the run loop

2015-03-22 Thread Graham Cox
> On 23 Mar 2015, at 9:52 am, Ken Thomases wrote: > > I'd be curious to know how "run all the time", "run as often as possible", > and "an endless loop" jibe with "not heavyweight processing" and "isn't going > to be a huge drain on anything" in your mind. > > Processor intensive code is not

Re: Inserting a task into the run loop

2015-03-22 Thread Graham Cox
> On 23 Mar 2015, at 9:52 am, Ken Thomases wrote: > > I'd be curious to know how "run all the time", "run as often as possible", > and "an endless loop" jibe with "not heavyweight processing" and "isn't going > to be a huge drain on anything" in your mind. > > Processor intensive code is not

Re: Inserting a task into the run loop

2015-03-22 Thread Ken Thomases
On Mar 22, 2015, at 5:23 PM, Graham Cox wrote: > I need my code to run all the time. It's not heavyweight processing, so it > isn't going to be a huge drain on anything, but it does need to have frequent > calls. My timer approach does keep the run loop awake, but it feels a bit off > to be us

Re: Inserting a task into the run loop

2015-03-22 Thread Graham Cox
> On 22 Mar 2015, at 4:21 pm, Kyle Sluder wrote: > > Use a run loop observer? OK, that looks relevant. I didn't see the term in NSRunLoop so But looking at the docs, I wonder if this is really what I want. If nothing is going on, won't my run loop simply go to sleep? That means I'm only

Re: Inserting a task into the run loop

2015-03-21 Thread Kyle Sluder
On Sat, Mar 21, 2015, at 10:27 PM, Graham Cox wrote: > I have a requirement that runs my code exactly once per run loop, and I'm > wondering what the modern preferred way to do this is. Use a run loop observer? --Kyle Sluder ___ Cocoa-dev mailing list

Inserting a task into the run loop

2015-03-21 Thread Graham Cox
I have a requirement that runs my code exactly once per run loop, and I'm wondering what the modern preferred way to do this is. I've developed the code using a timer with a very fast rate which I know can't really be met, so effectively it's calling back once per loop, but I figure there has t