Re: Destruction in D

2015-05-02 Thread bitwise via Digitalmars-d-learn
On Fri, 01 May 2015 14:37:40 -0400, Idan Arye wrote: Structs allow you to implement ref-counting smart pointers like you can do in C++. There is an implementation in the standard library: http://dlang.org/phobos/std_typecons.html#.RefCounted Yeah, I guess I should have taken the existence o

Re: Destruction in D

2015-05-02 Thread via Digitalmars-d-learn
On Friday, 1 May 2015 at 18:37:41 UTC, Idan Arye wrote: On Friday, 1 May 2015 at 17:45:02 UTC, bitwise wrote: On Friday, 1 May 2015 at 02:35:52 UTC, Idan Arye wrote: On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first p

Re: Destruction in D

2015-05-01 Thread Idan Arye via Digitalmars-d-learn
On Friday, 1 May 2015 at 17:45:02 UTC, bitwise wrote: On Friday, 1 May 2015 at 02:35:52 UTC, Idan Arye wrote: On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first place. I need to be able to acquire/release shared resour

Re: Destruction in D

2015-05-01 Thread bitwise via Digitalmars-d-learn
On Friday, 1 May 2015 at 02:35:52 UTC, Idan Arye wrote: On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first place. I need to be able to acquire/release shared resources reliably, like an OpenGL texture, for example. If

Re: Destruction in D

2015-04-30 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first place. I need to be able to acquire/release shared resources reliably, like an OpenGL texture, for example. If you want to release resources, you are going to have to

Re: Destruction in D

2015-04-30 Thread bitwise via Digitalmars-d-learn
On Thu, 30 Apr 2015 16:17:10 -0400, Adam D. Ruppe wrote: On Thursday, 30 April 2015 at 20:07:11 UTC, bitwise wrote: destructors are called on a separate thread, in parallel to the main thread. Is this correct? Not necessarily. the way the GC works in D today is whenever any thread alloc

Re: Destruction in D

2015-04-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 30 April 2015 at 20:07:11 UTC, bitwise wrote: destructors are called on a separate thread, in parallel to the main thread. Is this correct? Not necessarily. the way the GC works in D today is whenever any thread allocates, it runs the GC functions which might do a collection. Thi

Re: Destruction in D

2015-04-30 Thread weaselcat via Digitalmars-d-learn
On Thursday, 30 April 2015 at 20:07:11 UTC, bitwise wrote: After reading GC page in the reference, it seems that class destructors are called on a separate thread, in parallel to the main thread. Is this correct? There's no guarantee what thread will be used in the standard GC implementation

Destruction in D

2015-04-30 Thread bitwise via Digitalmars-d-learn
After reading GC page in the reference, it seems that class destructors are called on a separate thread, in parallel to the main thread. Is this correct? What about structs? Are the destructors called when they go out of scope in a C++ RAII fashion, or do they happen on a separate thread too?