Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How a runloop actually works

Earlier this month I asked this question 'What is a runloop?' After reading the answers and did some tries I got it to work, but still I do not understand it completely. If a runloop is just an loop that is associated with an thread and it don't spawn another thread behind the scenes how can any of the other code in my thread(mainthread to keep it simple) execute without getting "blocked"/not run because it somewhere make an infinite loop?

That was question number one. Then over to my second.

If I got something right about this after having worked with this, but not completely understood it a runloop is a loop where you attach 'flags' that notify the runloop that when it comes to the point where the flag is, it "stops" and execute whatever handler that is attached at that point? Then afterwards it keep running to the next in que.

runloop

So in this case no events is placed in que in connections, but when it comes to events it take whatever action associated with tap 1 and execute it before it runs to connections again and so on. Or am I as far as I can be from understanding the concept?

like image 667
LuckyLuke Avatar asked Nov 05 '22 02:11

LuckyLuke


1 Answers

"Sort of."

Have you read this particular documentation?

It goes into considerable depth -- quite thorough depth -- into the architecture and operation of run loops.

like image 76
bbum Avatar answered Nov 12 '22 14:11

bbum