News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Nikita Popov:
Cooperative multitasking using coroutines (in PHP!)
December 24, 2012 @ 09:46:36

Nikita Popov has a new post to his blog about a new feature that will be coming in PHP 5.5 and how to use them, coroutines and generators, in an example application.

Coroutines on the other hand have received relatively little attention. The reason is that coroutines are both a lot more powerful and a lot harder to understand and explain. In this article I'd like to guide you through an implementation of a task scheduler using coroutines, so you can get a feeling for the stuff that they allow you to do. I'll start off with a few introductory sections. If you feel like you already got a good grasp of the basics behind generators and coroutines, then you can jump straight to the "Cooperative multitasking" section.

He starts with a look at generators, a piece of functionality that will allow PHP to, for example, more easily create iterators "on the fly." He then moves on to coroutines, added functions that you have two-way communication with generators instead of just pulling data from them. With the basics out of the way, he gets into the "cooperative multitasking" and a sample socket-based server he implements using some of the concepts.

0 comments voice your opinion now!
generator coroutine multitasking server socket tutorial


blog comments powered by Disqus

Similar Posts

InsicDesigns Blog: Embracing PHP 5.3 MVC with MiMViC

NetTuts.com: How to Work with PHP and FTP

SitePoint PHP Blog: How to Use PHP Namespaces, Part 1: The Basics

AnyExample.com: Bar chart HTML generator

BinaryTides.com: Setup Nginx + php-FPM + apc + MariaDB on Debian 7 - The perfect LEMP server


Community Events





Don't see your event here?
Let us know!


series release symfony version opinion update library framework introduction voicesoftheelephpant interview tool podcast language community composer package laravel security mvc

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework