www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can't use threads

reply Aldo <aldocd4 outlook.com> writes:
Hello,

i'm trying to run 3 threads with the following code :

https://run.dlang.io/is/p4ThlD

It works on run.dlang.io but not on my windows 10 :

core.thread.ThreadError src\core\thread.d(3078): Unable to load 
thread context

If I lower the allocated ubyte array it works...can you help me ?

thanks.
May 04 2019
next sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote:
 Hello,

 i'm trying to run 3 threads with the following code :

 https://run.dlang.io/is/p4ThlD

 It works on run.dlang.io but not on my windows 10 :

 core.thread.ThreadError src\core\thread.d(3078): Unable to load 
 thread context

 If I lower the allocated ubyte array it works...can you help me 
 ?

 thanks.
Does it work on windows if you compile it it as 64 bit application (-m64 argument if I remember correctly, dub argument -a x86_64)? On linux and Darwin 64 is default while on windows 32 bit architecture is default. Kind regards Andre
May 04 2019
parent reply Aldo <aldocd4 outlook.com> writes:
On Sunday, 5 May 2019 at 03:32:37 UTC, Andre Pany wrote:
 On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote:

 Does it work on windows if you compile it it as 64 bit 
 application (-m64 argument if I remember correctly, dub 
 argument -a x86_64)?
 On linux and Darwin 64 is default while on windows 32 bit 
 architecture is default.

 Kind regards
 Andre
No. I tried to compile it as 64 bit and 32, I lowered ubyte[] data to 4096, and I still have this exception. Used dub and dmd -i to compile. Thats weird.
May 05 2019
parent Andre Pany <andre s-e-a-p.de> writes:
On Sunday, 5 May 2019 at 12:28:34 UTC, Aldo wrote:
 On Sunday, 5 May 2019 at 03:32:37 UTC, Andre Pany wrote:
 On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote:

 Does it work on windows if you compile it it as 64 bit 
 application (-m64 argument if I remember correctly, dub 
 argument -a x86_64)?
 On linux and Darwin 64 is default while on windows 32 bit 
 architecture is default.

 Kind regards
 Andre
No. I tried to compile it as 64 bit and 32, I lowered ubyte[] data to 4096, and I still have this exception. Used dub and dmd -i to compile. Thats weird.
What I can see from source code in DRuntime, windows api GetThreadContext is failing, therefore the error message you can see. Can you test it with a recent version of dmd and if error still exists, please file an issue on issues.dlang.org Kind regards Andre
May 05 2019
prev sibling next sibling parent reply zabruk <sorry noem.ail> writes:
It works for me (Microsoft Windows [Version 10.0.17134.706] 
64-bit)

start!
start!
start!
end!
end!
end!

start!
start!
end!
start!
end!
end!
May 05 2019
parent zabruk <sorry noem.ail> writes:
DMD32 D Compiler v2.084.0

code comiled by command

dmd -i "test.d"

On Sunday, 5 May 2019 at 09:31:13 UTC, zabruk wrote:
 It works for me (Microsoft Windows [Version 10.0.17134.706] 
 64-bit)

 start!
 start!
 start!
 end!
 end!
 end!

 start!
 start!
 end!
 start!
 end!
 end!
May 05 2019
prev sibling parent reply Ron Tarrant <rontarrant gmail.com> writes:
On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote:

 i'm trying to run 3 threads with the following code :

 https://run.dlang.io/is/p4ThlD
Works for me... Windows 10 Pro DMD 2.085.1 (-de -w -m64 switches) Note: I didn't use dub, so perhaps there's something going on there.
May 06 2019
parent Aldo <aldocd4 outlook.com> writes:
On Monday, 6 May 2019 at 09:46:46 UTC, Ron Tarrant wrote:
 On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote:

 i'm trying to run 3 threads with the following code :

 https://run.dlang.io/is/p4ThlD
Works for me... Windows 10 Pro DMD 2.085.1 (-de -w -m64 switches) Note: I didn't use dub, so perhaps there's something going on there.
Tried the code at work, its working on a Windows 10 machine...it's crazy. I used the same DMD (last release)...I will try to debug this at home later. Thanks for your help.
May 06 2019