while(true)

Selim Ozel sozel at wpi.edu
Sun Sep 26 11:19:12 UTC 2021


On Sunday, 26 September 2021 at 08:50:47 UTC, Imperatorn wrote:
> On Saturday, 25 September 2021 at 10:37:25 UTC, Selim Ozel 
> wrote:
>> On Saturday, 25 September 2021 at 10:32:10 UTC, jfondren wrote:
>>> On Saturday, 25 September 2021 at 10:17:32 UTC, Selim Ozel 
>>> wrote:
>>>> [...]
>>>
>>> What this program does is run with two threads, one sleeping 
>>> in a loop and one waiting for the other thread to end. If 
>>> you're starting a thread so that you can call Thread.sleep in 
>>> it, that's not necessary. You could just rename `threadFunc` 
>>> to `main` here, and of course get rid of the original main(), 
>>> and it'd work.
>>
>> That's much better. Thanks a lot.
>>
>> Selim
>
> Just a reminder, you can also write 5.seconds

The final program is.

```d
import core.thread;

void main() {
   while(true) {
     Thread.sleep(5.seconds);
   }
}
```



More information about the Digitalmars-d mailing list