基于 Vala 和 GObject 的并行库:Gpseq

左心房为你撑大大i 提交于 2019-12-04 06:38:20

基于 Vala 和 GObject 的并行库:Gpseq 提供如下特性:

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

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

  • Fork-join parallelism

  • Parallel sorting

  • Futures and promises

  • 64-bit atomic operations

  • Overflow safe arithmetic functions for signed integers

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

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!