タグ

関連タグで絞り込む (3)

タグの絞り込みを解除

coroutineに関するtictacのブックマーク (3)

  • callcc と coroutine と semi-coroutine - まめめも

    Ruby で callcc を使って coroutine や semi-coroutine を書いてみました。あまり考えずに試行錯誤で書いたので間違ってるかもしれませんが、とりあえず晒してみます。 coroutine は Modula-2 で採用されているもの、semi-coroutine は Lua で採用されているもの *1 を実装したつもりです。 callcc で coroutine まずサンプル。以下のコードは 1 、3 、2 を出力して終了します。 c1, c2 = Coroutine.new { p 1; c2.start; p 2 }, Coroutine.new { p 3; c1.start; p 4 } c1.start $ ruby -rcoroutine test.rb 1 3 2かいつまんで解説。 coroutine.start で coroutine を起動しま

    callcc と coroutine と semi-coroutine - まめめも
  • [ruby-dev:30827] Supporting Fiber

    Subject: [ruby-dev:30827] Supporting Fiber From: SASADA Koichi <ko1@ d . t Date: Mon, 28 May 2007 05:01:17 +0900 ささだです。 Continuation のついでに Fiber を入れました。金曜日には出来てたんです が、もろもろあってコミットが遅くなってしまいました。 というわけで、皆様にいくつかご相談です。おもに、名前と機能の話です。広 くご意見を頂けると幸いです。 開発した「Fiber」の概要: Fiber はノンプリエンプティブなスレッドで、MicroThreadと言われたりしま す。Coroutine と言っても良いかもしれません。ググればたくさん情報は出てく ると思います。 従来のスレッドでのコンテキスト切り替えのタイミングは、おもに次の3つで した。 (1) Thr

  • Coroutines in C

    by Simon Tatham [Coroutines trilogy: C preprocessor | C++20 native | general philosophy ] Introduction Structuring a large program is always a difficult job. One of the particular problems that often comes up is this: if you have a piece of code producing data, and another piece of code consuming it, which should be the caller and which should be the callee? Here is a very simple piece of run-leng

  • 1