Getting started with event loops: the magic of select

Опубликовано: 01 Январь 1970
на канале: Thomas Ballinger
21,515
286

Somebody who knew Python asked me what an event loop was, and instead of rambling in a text box I decided to ramble in a video.

I'm not sure why this is a popular video! I was answering one person't question and the video doesn't make much sense outside of this context.

In this video we write a little chat client in Python that needs to use two different blocking calls concurrently: reading a line of user input and reading messages from a server. How can we do two "blocking" things (waiting for the user to type and waiting for messages to come in over the wire) at once? Should we switch to nonblocking apis for both of these, and just poll for each and switch between them really fast? No! Let's block on both of them at the same time with select! Then draw the rest of the owl and tada, an event loop!


Смотрите видео Getting started with event loops: the magic of select онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Thomas Ballinger 01 Январь 1970, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 21,515 раз и оно понравилось 286 людям.