基於 Vala 和 GObject 的並行庫:Gpseq

基於 Vala 和 GObject 的並行庫:Gpseq 提供以下特性:html

  • Work-stealing and managed blocking task scheduling: Similar behavior to Go schedulerjava

  • Functional programming for data processing with parallel execution support: An equivalent to Java’s streamsgit

  • Fork-join parallelismapi

  • Parallel sortingpromise

  • Futures and promisesoracle

  • 64-bit atomic operationsgitlab

  • Overflow safe arithmetic functions for signed integersui

References

案例代碼

using Gpseq;

void main () {
    string[] array = {"dog", "cat", "pig", "boar", "bear"};
    Seq.of_array<string>(array)
        .parallel()
        .filter(g => g.length == 3)
        .map<string>(g => g.up())
        .foreach(g => print("%s\n", g))
        .wait();
}

// (possibly unordered) output:
// DOG
// CAT
// PIG
相關文章
相關標籤/搜索