Program exiting from thread with infinite loop
Steven Schveighoffer
schveiguy at yahoo.com
Fri Jan 19 20:43:18 UTC 2018
On 1/19/18 12:05 PM, Chris M. wrote:
> I have the following that is supposed to pull and store info from a
> server every five minutes. It works if I move the body of
> deviceDownloader into main(). However when I try to spawn it in another
> thread it runs the function and then ends once it's done, like it's
> ignoring the while(true). I tried with std.parallelism, core.thread,
> vibe.d's concurrency library, but get the same result every time. Any
> idea how to better accomplish this?
>
>
> import std.net.curl;
> import device;
> import std.datetime.systime;
> impor std.concurrency;
>
> void deviceDownloader()
> {
> auto APIServer = HTTP();
> APIServer.addRequestHeader("X-Auth-Token:", AuthToken);
> APIServer.onProgress = delegate int(size_t dl, size_t dln, size_t
> ul, size_t uln)
> {
> if (dl != 0)
> write("Progress: downloaded ", dln, " of ", dl, "\r");
What is this call doing? You aren't importing std.stdio, so it can't be
D's normal write call.
-Steve
More information about the Digitalmars-d-learn
mailing list