Nicolas S.Xu
Nicolas S.Xu

Reputation: 14544

Why do I need an the event loop in gevent?

This is the official introduction for gevent. After reading it, I still have no idea what is gevent. It looks like gevent is a collection of :

I never heard of things about event loop in javascript. Event and message is implemented as function call. There is no loop. while (true) {} is wrong period.

My question is: What is event loop in the gevent? Why do I need it?

Upvotes: 0

Views: 716

Answers (1)

nosklo
nosklo

Reputation: 223032

event loop is how every asynchronous event system works. There is a loop, checking for events and waiting for things to happen. When something happens, it deals with event - that is it will call some code and when that code is over, returns to the loop.

There is no magical way to call your code when something happens - you need a loop checking for conditions and calling the correct code. Frequently the loop is hidden inside the library/framework but that doesn't mean it doesn't exist.

Upvotes: 2

Related Questions