Re: shared not working!

2016-07-03 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Monday, 4 July 2016 at 05:08:34 UTC, ag0aep6g wrote: On 07/04/2016 01:20 AM, Hiemlick Hiemlicker wrote: I have thread. It locks up. If I changed from a bool val it is using from shared to __gshared it works. I checked the address inside and outside of the thread and they are different for

Commit size and Page fault's very large for simple program

2016-07-03 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
version(Windows) void main() { import std.random; while(getchar() != EOF) { auto x = new int[std.random.uniform(100, 1000)]; writeln(""); bThread.Now(); } } more or less, ends up with a huge

Re: shared not working!

2016-07-03 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Monday, 4 July 2016 at 01:36:00 UTC, Mike Parker wrote: On Sunday, 3 July 2016 at 23:20:35 UTC, Hiemlick Hiemlicker wrote: The only difference is that the thread is a windows CreateThread. I guess D doesn't know about such threads and hence shared doesn't extend across to them? The

Re: Thunking problems with arch issues

2016-07-02 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Saturday, 2 July 2016 at 01:51:03 UTC, rikki cattermole wrote: Couple of things could be happening. 1) Alignments are off, aligning of data really really matters Where? I rewrote the code to use size_t and same problem. If alignments were off chances are it wouldn't exhibit the issues in

Re: static __gshared struct

2016-07-02 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Saturday, 2 July 2016 at 03:54:26 UTC, Mike Parker wrote: On Saturday, 2 July 2016 at 00:08:10 UTC, Hiemlick Hiemlicker wrote: I use a struct with static members so I do not have to instantiate it. It is essentially a singleton. I want all the variables to be __gshared. I guess I have

Re: Does D has any support for thunks?

2016-07-01 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Saturday, 25 June 2016 at 17:52:48 UTC, Andre Pany wrote: On Saturday, 25 June 2016 at 17:26:03 UTC, Andre Pany wrote: On Saturday, 25 June 2016 at 16:05:30 UTC, Vladimir Panteleev wrote: On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote: Does D/Phobos has any support for thunks?

Thunking problems with arch issues

2016-07-01 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
The following code works on dmd x64. Fails on dmd x32 and ldc x64. The problem is the passed variable. import std.stdio; version (Windows) { import core.sys.windows.windows; void makeExecutable(ubyte[] code) { DWORD old; VirtualProtect(code.ptr, code.length,

Re: static __gshared struct

2016-07-01 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Friday, 1 July 2016 at 23:36:35 UTC, Basile B. wrote: On Friday, 1 July 2016 at 23:26:19 UTC, Hiemlick Hiemlicker wrote: On Friday, 1 July 2016 at 23:03:17 UTC, Basile B. wrote: On Friday, 1 July 2016 at 22:47:21 UTC, Hiemlick Hiemlicker wrote: Ok, Does that mean void main() {

Re: static __gshared struct

2016-07-01 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Friday, 1 July 2016 at 23:03:17 UTC, Basile B. wrote: On Friday, 1 July 2016 at 22:47:21 UTC, Hiemlick Hiemlicker wrote: what exactly does this do? are all members _gshared? In this case __gshared is a complete NOOP. __gshared has only an effect on variables. It prevents them to reside in

static __gshared struct

2016-07-01 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
what exactly does this do? are all members _gshared?

Re: IFTI in Eponymous Templates

2016-06-29 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 18:59:19 UTC, jmh530 wrote: I was playing around with some Eponymous Templates. I had been under the impression that Implicit Function-Template Instantiation (IFTI) meant that you don't have to explicitly instantiate all functions. However, it seems like there are

Re: core.stdc.stdlib.malloc & alignment

2016-06-28 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 02:24:55 UTC, captaindet wrote: is there an alignment guarantee for core.stdc.stdlib.malloc? more specifically, using DMD and compiling for 32bit on windows, can i assume proper alignment for int or uint variables? background: i like to re-use a (ubyte) buffer,