Program exiting from thread with infinite loop

Chris M. chrismohrfeld at comcast.net
Fri Jan 19 21:24:28 UTC 2018


On Friday, 19 January 2018 at 21:01:51 UTC, Steven Schveighoffer 
wrote:
> On 1/19/18 3:54 PM, Chris M. wrote:
>> On Friday, 19 January 2018 at 20:43:18 UTC, Steven 
>> Schveighoffer wrote:
>>> On 1/19/18 12:05 PM, Chris M. wrote:
>>>> [...]
>>>
>>> What is this call doing? You aren't importing std.stdio, so 
>>> it can't be D's normal write call.
>>>
>>> -Steve
>> 
>> It is, left out the import on accident.
>> 
>> I commented out the call to retrieveDevices, and now it's 
>> working, so at least I'm zoning in a bit. Appreciate all the 
>> help so far though.
>
> Hm... noticed you missed a 't' here as well:
>
> impor std.concurrency;
>
> It helps if you post actual working (or reproducing in any 
> case) code. I've seen so many posts on this forum where people 
> re-type their code in the post instead of copy-pasting, and 
> then inadvertently leave out a major hint leading to the actual 
> issue :)
>
> -Steve

Might have happened here.

I left out two lines from main() that were for initializing a 
database because I didn't think they were relevant, then I 
realized the database was only being initialized in the main 
thread and not the one I was spawning. retrieveDevices() tried to 
access it and got a segfault (which I was ignoring because I was 
already getting a segfault from something else from before I put 
in threading). Should have been a red flag, but I moved the 
database initialization into the thread and it's working now.


More information about the Digitalmars-d-learn mailing list