background preloader

CoRoutines

Facebook Twitter

Google Translate. Martinheidegger/ThreadStepProcessor/en. (Japanese page) ActionScript Thread StepProcessor is a extension to the Thread Library for multi threading based on pseudo threads. Downloads ¶ Documentation ¶ License ¶ Licensed under the MIT License Copyright (c) 2008 Leichtgewicht (www.leichtgewicht.at) and Spark project (www.libspark.org) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Design & Code Martin Heidegger. Threader. ActionScript Thread Library 1.0 (そうめん) ドキュメント.

ActionScript Thread Library 1.0 (そうめん) は、タスクシステムと Java のスレッドモデルをベースとした疑似スレッドライブラリです。 複雑で冗長になりがちな、イベント処理や非同期処理、リアルタイム処理を、分かりやすくスマートに記述することを可能にします。 もちろん、割り込みやキャンセル、例外処理もバッチリです。 スレッドを使って、イベントリスナー地獄から抜け出しましょう。 ※ActionScript Thread Library は、名前こそスレッドですが、実体はタスクシステムにスレッドモデルを搭載したものなので、 「スレッド」と考えるよりは、「タスクシステム」だと考えた方が理解が早いでしょう。 このドキュメントもその前提でお読みください。 AIR Link Report visualizer. The Flex compiler has a rarely used feature called “link-report”.

AIR Link Report visualizer

Using this option instructs the compiler to create a report of all symbols that went into the compiled application as well as a list of all external references. Coroutines via Enhanced Generators. PEP Index> PEP 342 -- Coroutines via Enhanced Generators Introduction This PEP proposes some enhancements to the API and syntax of generators, to make them usable as simple coroutines.

Coroutines via Enhanced Generators

It is basically a combination of ideas from these two PEPs, which may be considered redundant if this PEP is accepted: - PEP 288, Generators Attributes and Exceptions. The current PEP covers its second half, generator exceptions (in fact the throw() method name was taken from PEP 288). PEP 342 replaces generator attributes, however, with a concept from an earlier revision of PEP 288, the "yield expression". - PEP 325, Resource-Release Support for Generators.

Motivation Coroutines are a natural way of expressing many algorithms, such as simulations, games, asynchronous I/O, and other forms of event- driven programming or co-operative multitasking. Specification Summary. Caliburn: A Client Framework for WPF and Silverlight. IResult is one of the most powerful features of Actions.

Caliburn: A Client Framework for WPF and Silverlight

Any action can return an instance of IResult or IEnumerable IResult enables handling many difficult programming scenarios with ease, mainly asynchronous programming. Here's an example of what you can do: public IEnumerable<IResult> Login(string username, string password) { var authenticator = new AuthenticateResult(username, password); yield return authenticator; if(! Authenticator.Succeeded) { yield return Show.MessageBox("The username or password provided is incorrect. Liber.sourceforge.net/coroutines.rb. Index. Cogen - Crossplatform asynchronous network oriented python framework based on python 2.5 enhanced generators. Heavy Industries: public Git repositories - chiral.git/summary. Package Index : multitask 0.2.0. Package Index > multitask > 0.2.0 Not Logged In.

Package Index : multitask 0.2.0

API docs for “kiwi.tasklet” Pseudo-thread (coroutines) framework This module adds infrastructure for managing tasklets.

API docs for “kiwi.tasklet”

In this context, a tasklet is defined as a routine that explicitly gives back control to the main program a certain points in the code, while waiting for certain events. Other terms that may be used to describe tasklets include coroutines, or cooperative threads. The main advantages of tasklets are: Denis / gevent / source – Bitbucket. Event – Notifications of multiple listeners — gevent v0.13.5 documentation. Class gevent.event.Event A synchronization primitive that allows one greenlet to wake up one or more others.

event – Notifications of multiple listeners — gevent v0.13.5 documentation

It has the same interface as threading.Event but works across greenlets. An event object manages an internal flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. Chapter 1. Boost.Coroutine. Code - Mordor. Mordor allows you to focus on performing a logical task, instead of deciding how to make that task conform to a specific threading/event model.

Code - Mordor

Just because local disk I/O will block and should be performed in a thread pool while network I/O should be performed using an event based callback design, doesn't mean you can't do them both in the same function. Mordor allows you to do just that. For example, here's a complete program to read a file from disk, and send it to a socket on the network: Pieces/Xtalion/Coroutines/Yield.cs at master from yevhen/Servelat-Pieces - GitHub. Coroutine. Iterators and generators - MDC Doc Center. Processing each of the items in a collection is a very common operation.

Iterators and generators - MDC Doc Center

JavaScript provides a number of ways of iterating over a collection, from simple for and for each loops to map(), filter() and array comprehensions. Iterators and Generators, introduced in JavaScript 1.7, bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of for...in and for each loops. Iterators An Iterator is an object that knows how to access items from a collection one at a time, while keeping track of its current position within that sequence. In JavaScript an iterator is an object that provides a next() method which returns the next item in the sequence. Once created, an iterator object can be used either explicitly by repeatedly calling next(), or implicitly using JavaScript's for...in and for each constructs. Simple iterators for objects and arrays can be created using the Iterator() function: Caliburn.Micro Soup to Nuts Pt. 5 – IResult and Coroutines.

Before our WP7 detour, we were deep in the thick of Actions.

Caliburn.Micro Soup to Nuts Pt. 5 – IResult and Coroutines

I mentioned that there was one more compelling feature of the Actions concept called Coroutines. If you haven’t heard that term before, here’s what wikipedia* has to say: Here’s one way you can thing about it: Imagine being able to execute a method, then pause it’s execution on some statement, go do something else, then come back and resume execution where you left off. This technique is extremely powerful in task-based programming, especially when those tasks need to run asynchronously. For example, let’s say we have a ViewModel that needs to call a web service asynchronously, then it needs to take the results of that, do some work on it and call another web service asynchronously.

First, notice that the Action “GoForward” has a return type of IEnumerable<IResult>. Public interface IResult { void Execute(ActionExecutionContext context); event EventHandler<ResultCompletionEventArgs> Completed; } Fun with Rx. Download source code - 292 KB Introduction This article is an exploratory look into the Microsoft DevLabs project called Reactive Framework (Rx for short).

Fun with Rx

I feel kind of weird saying this, but the demo solution that comes with this article will provide you nothing re-usable at all, but what it should hopefully do is give you an understanding of how Rx works. Prerequisites As the Reactive Framework is still effectively a DevLabs project, and not entirely in the mainstream .NET Framework (yet), you are still required to download and install an MSI, which you can find at the following URL: where the demo app relies on the "Rx for .NET 4.0" option being downloaded and installed. Frictionless WCF service consumption in Silverlight - Part 2: Fixing the "All Is Async" Problem. Download source code - 31 KB Introduction In my previous article, I've shown how to consume a WCF service in a Silverlight application without static proxy generation, by creating its asynchronous twin interface.