Re: Foreign threads in D code.

2017-07-12 Thread Igor Shirkalin via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 09:49:32 UTC, Guillaume Piolat wrote: On Tuesday, 11 July 2017 at 22:59:42 UTC, Igor Shirkalin wrote: [...] -- Biotronic Thanks for very useful information! Just one small note. If you don't know the foreign thread lifetime, it's cleaner to detach it from t

Re: Foreign threads in D code.

2017-07-12 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 12:08:35 UTC, Jacob Carlborg wrote: On 2017-07-12 11:28, Biotronic wrote: That's basically what I tried to say It wasn't very clear to me at least. Yeah, I see it in retrospect. "might collect memory that the thread is referencing on the stack or in non-GC mem

Re: Foreign threads in D code.

2017-07-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-12 11:28, Biotronic wrote: That's basically what I tried to say It wasn't very clear to me at least. - the GC may collect memory *it has allocated* if the only pointers to it are in memory the GC doesn't scan (i.e. on the stack of an unregistered thread or in memory not allocated

Re: Foreign threads in D code.

2017-07-12 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 11 July 2017 at 22:59:42 UTC, Igor Shirkalin wrote: On Tuesday, 11 July 2017 at 06:18:44 UTC, Biotronic wrote: On Monday, 10 July 2017 at 20:03:32 UTC, Igor Shirkalin wrote: [...] If DRuntime is not made aware of the thread's existence, the thread will not be stopped by the GC, a

Re: Foreign threads in D code.

2017-07-12 Thread Biotronic via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 09:10:07 UTC, Jacob Carlborg wrote: On 2017-07-11 08:18, Biotronic wrote: If DRuntime is not made aware of the thread's existence, the thread will not be stopped by the GC, and the GC might collect memory that the thread is referencing on the stack or in non-GC m

Re: Foreign threads in D code.

2017-07-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-11 08:18, Biotronic wrote: If DRuntime is not made aware of the thread's existence, the thread will not be stopped by the GC, and the GC might collect memory that the thread is referencing on the stack or in non-GC memory. Are you sure? Wouldn't that make malloc or any other custom

Re: Foreign threads in D code.

2017-07-11 Thread Igor Shirkalin via Digitalmars-d-learn
On Tuesday, 11 July 2017 at 06:18:44 UTC, Biotronic wrote: On Monday, 10 July 2017 at 20:03:32 UTC, Igor Shirkalin wrote: [...] If DRuntime is not made aware of the thread's existence, the thread will not be stopped by the GC, and the GC might collect memory that the thread is referencing on

Re: Foreign threads in D code.

2017-07-10 Thread Biotronic via Digitalmars-d-learn
On Monday, 10 July 2017 at 20:03:32 UTC, Igor Shirkalin wrote: Hello! I have written some D code that I need to link to :C++ huge project. Let it be just one function that uses GC. The question is: if C++ code creates several threads and runs this :D function simultaneously, will GC work corr

Foreign threads in D code.

2017-07-10 Thread Igor Shirkalin via Digitalmars-d-learn
Hello! I have written some D code that I need to link to :C++ huge project. Let it be just one function that uses GC. The question is: if C++ code creates several threads and runs this :D function simultaneously, will GC work correctly? p.s. Of course the druntime is initialized before it.