Re: low-latency GC

2020-12-05 Thread Bruce Carneal via Digitalmars-d-learn
On Sunday, 6 December 2020 at 06:52:41 UTC, Ola Fosheim Grostad wrote: On Sunday, 6 December 2020 at 05:41:05 UTC, Bruce Carneal wrote: OK. Some rationale? Do you, for example, believe that no-probable-dlanger could benefit from a low-latency GC? That it is too hard to implement? That the l

Re: low-latency GC

2020-12-05 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Sunday, 6 December 2020 at 05:41:05 UTC, Bruce Carneal wrote: OK. Some rationale? Do you, for example, believe that no-probable-dlanger could benefit from a low-latency GC? That it is too hard to implement? That the language is somehow incompatible? That ... The GC needs to scan all th

Re: low-latency GC

2020-12-05 Thread Bruce Carneal via Digitalmars-d-learn
On Sunday, 6 December 2020 at 05:29:37 UTC, Ola Fosheim Grostad wrote: On Sunday, 6 December 2020 at 05:16:26 UTC, Bruce Carneal wrote: How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have th

Re: low-latency GC

2020-12-05 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Sunday, 6 December 2020 at 05:16:26 UTC, Bruce Carneal wrote: How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have the low-latency GC in hand"? I've heard Walter mention performance issue

low-latency GC

2020-12-05 Thread Bruce Carneal via Digitalmars-d-learn
How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have the low-latency GC in hand"? I've heard Walter mention performance issues (write barriers IIRC). I'm also interested in the GC-flavor pe

Re: converting D's string to use with C API with unicode

2020-12-05 Thread tsbockman via Digitalmars-d-learn
On Sunday, 6 December 2020 at 02:07:10 UTC, Jack wrote: On Saturday, 5 December 2020 at 23:31:31 UTC, tsbockman wrote: On Saturday, 5 December 2020 at 21:55:13 UTC, Jack wrote: wstring ws; transcode(output[i], ws); auto s = malloc(ws.length + 1); if(!s) { onOutOfMemoryEr

Re: converting D's string to use with C API with unicode

2020-12-05 Thread Виталий Фадеев via Digitalmars-d-learn
On Saturday, 5 December 2020 at 19:51:14 UTC, Jack wrote: So in D I have a struct like this: struct ProcessResult { string[] output; bool ok; } in order to use output from C WINAPI with unicode, I need to convert each string to wchar* so that i can acess it from C with wchar

Re: converting D's string to use with C API with unicode

2020-12-05 Thread Jack via Digitalmars-d-learn
On Saturday, 5 December 2020 at 23:31:31 UTC, tsbockman wrote: On Saturday, 5 December 2020 at 21:55:13 UTC, Jack wrote: my code now look like this, still there's a memory corrupt. Could anyone help point out where is it? ... foreach(i; 0..output.length) { wstring ws; transcode(outpu

Re: converting D's string to use with C API with unicode

2020-12-05 Thread tsbockman via Digitalmars-d-learn
On Saturday, 5 December 2020 at 21:55:13 UTC, Jack wrote: my code now look like this, still there's a memory corrupt. Could anyone help point out where is it? ... foreach(i; 0..output.length) { wstring ws; transcode(output[i], ws); auto s = malloc(ws.length + 1); if(!s) {

Re: converting D's string to use with C API with unicode

2020-12-05 Thread Jack via Digitalmars-d-learn
I totally forget to malloc() the strings and array. I don't do C has been a while and totally forget this, thank you so much guys for your answer. my code now look like this, still there's a memory corrupt. Could anyone help point out where is it? struct ProcessResult { string[] out

Re: converting D's string to use with C API with unicode

2020-12-05 Thread tsbockman via Digitalmars-d-learn
On Saturday, 5 December 2020 at 19:51:14 UTC, Jack wrote: version(Windows) extern(C) export struct C_ProcessResult { wchar*[] output; In D, `T[]` (where T is some element type, `wchar*` in this case) is a slice structure that bundles a length and a pointer together. It is NOT the same

Re: converting D's string to use with C API with unicode

2020-12-05 Thread IGotD- via Digitalmars-d-learn
On Saturday, 5 December 2020 at 20:12:52 UTC, IGotD- wrote: On Saturday, 5 December 2020 at 19:51:14 UTC, Jack wrote: So in D I have a struct like this: struct ProcessResult { string[] output; bool ok; } in order to use output from C WINAPI with unicode, I need to convert ea

Re: converting D's string to use with C API with unicode

2020-12-05 Thread IGotD- via Digitalmars-d-learn
On Saturday, 5 December 2020 at 19:51:14 UTC, Jack wrote: So in D I have a struct like this: struct ProcessResult { string[] output; bool ok; } in order to use output from C WINAPI with unicode, I need to convert each string to wchar* so that i can acess it from C with wchar

converting D's string to use with C API with unicode

2020-12-05 Thread Jack via Digitalmars-d-learn
So in D I have a struct like this: struct ProcessResult { string[] output; bool ok; } in order to use output from C WINAPI with unicode, I need to convert each string to wchar* so that i can acess it from C with wchar_t*. Is that right or am I missing anything? struct Pro

Re: Is core.thread.osthread.Thread thread-safe?

2020-12-05 Thread tsbockman via Digitalmars-d-learn
On Saturday, 5 December 2020 at 18:58:13 UTC, Adam D. Ruppe wrote: On Saturday, 5 December 2020 at 18:48:19 UTC, tsbockman wrote: (The documentation for core.thread is broken right now, with dead links and at least one reference to an example that doesn't actually appear anywhere on the page.)

Re: Is core.thread.osthread.Thread thread-safe?

2020-12-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 5 December 2020 at 18:48:19 UTC, tsbockman wrote: (The documentation for core.thread is broken right now, with dead links and at least one reference to an example that doesn't actually appear anywhere on the page.) im not sure about your other question but use my docs they actual

Is core.thread.osthread.Thread thread-safe?

2020-12-05 Thread tsbockman via Digitalmars-d-learn
I want to do this: import core.thread.osthread : Thread; void main() { shared(Thread) thread1 = new Thread({ // Do stuff for a while... }); auto thread2 = new Thread({ // ... if(thread1.isRunning) // Do a thing. else // Do a differe