Como puedo hacer funciones asincronas?
Ali Çehreli
acehreli at yahoo.com
Sun Jun 18 16:32:45 UTC 2023
On 6/17/23 20:20, Cecil Ward wrote:
> On Saturday, 17 June 2023 at 22:05:37 UTC, Danico wrote:
>> hola gente, quisiera saber como es que puedo hacer funciones asincronas.
>> `
>> #!/usr/bin/env dmd
>> import std;
>> import std.stdio;
>> import std.concurrency;
>> //import archivo2;
>>
>> alias print = writeln;
>>
>> void main () {
>>
>> auto tarea1 = spawn(&saludo);
>> auto tarea2 = spawn(&saludo2);
>>
>> print("realizando tareas ");
>>
>>
>> }
>>
>> void saludo () {
>> print("hola");
>> }
>>
>> async saludo2 () {
Replace that 'async' with 'void':
void saludo2 () {
>> print("hola2");
>> }
>>
>> `
>
> This is something I have wanted to achieve also.
It just works with that change. std.concurrency appears here in one of
my presentations:
https://youtu.be/dRORNQIB2wA?t=1735
And some text here:
http://ddili.org/ders/d.en/concurrency.html
Ali
More information about the Digitalmars-d-learn
mailing list