Re: Como puedo hacer funciones asincronas?

2023-06-18 Thread Ali Çehreli via Digitalmars-d-learn

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();
>> auto tarea2 = spawn();
>>
>> 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



Re: Como puedo hacer funciones asincronas?

2023-06-17 Thread Cecil Ward via Digitalmars-d-learn

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();
auto tarea2 = spawn();

print("realizando tareas ");


}

void saludo () {
print("hola");
}

async saludo2 () {
print("hola2");
}

`


This is something I have wanted to achieve also.


Como puedo hacer funciones asincronas?

2023-06-17 Thread Danico via Digitalmars-d-learn
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();
auto tarea2 = spawn();

print("realizando tareas ");


}

void saludo () {
print("hola");
}

async saludo2 () {
print("hola2");
}

`