guillotine 0.0.2-beta

Executor framework with future-based task submission and pluggable thread execution engines


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

guillotine

D DUB DUB DUB

Executor framework with future-based task submission and pluggable thread execution engines

Usage

You can add this to your project easily by using:

dub add guillotine

API

The full API is documented at here.

Example

Tests the submission of three tasks using the Sequential provider and with the first two tasks having values to return and the last having nothing.

import guillotine.providers.sequential;
import guillotine.executor;
import guillotine.future;
import guillotine.result;
import guillotine.provider;

Provider provider = new Sequential();

// Start the provider so it can execute
// submitted tasks
provider.start();

// Create an executor with this provider
Executor t = new Executor(provider);


// Submit a few tasks
Future fut1 = t.submitTask!(hi);
Future fut2 = t.submitTask!(hiFloat);
Future fut3 = t.submitTask!(hiVoid);

// Await on the first task
writeln("Fut1 waiting...");
Result res1 = fut1.await();
writeln("Fut1 done with: '", res1.getValue().value.integer, "'");

// Stops the internal task runner thread
provider.stop();

Let's also define those functions we are using:

public int hi()
{
    writeln("Let's go hi()!");

    // Pretend to do some work
    Thread.sleep(dur!("seconds")(2));

    return 69;
}

public float hiFloat()
{
    writeln("Let's go hiFloat()!");

    // Pretend to do some work
    Thread.sleep(dur!("seconds")(10));
    
    return 69.420;
}

public void hiVoid()
{
    writeln("Let's go hiVoid()!");

    // Pretend to do some work
    Thread.sleep(dur!("seconds")(10));
}
Authors:
  • Tristan B. Velloza Kildaire
Dependencies:
libsnooze
Versions:
0.2.2-alpha 2023-Nov-18
0.2.1-alpha 2023-Oct-01
0.2.0-alpha 2023-Oct-01
0.1.4-beta 2023-Oct-01
0.1.3-beta 2023-Oct-01
Show all 25 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 211 downloads total

Score:
0.2
Short URL:
guillotine.dub.pm