Skip to content

Instantly share code, notes, and snippets.

@run-dlang
Created September 22, 2023 04:21
Show Gist options
  • Save run-dlang/218b69e1afd79e5944ea10aa7ca61e1b to your computer and use it in GitHub Desktop.
Save run-dlang/218b69e1afd79e5944ea10aa7ca61e1b to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io. Run with '-unittest'
import std.stdio;
void main()
{
import std.parallelism;
auto a = new A();
auto fn = &a.download;
string url = "https://raw.githubusercontent.com/dlang/dmd/master/VERSION";
auto async_task = task!fn( url ); // error
async_task.executeInNewThread();
writeln("OK");
}
class A
{
void download( string url )
{
// DO
}
}
@vitalfadeev
Copy link

remove this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment