Use of mutex in destructors
Rene Zwanenburg
renezwanenburg at gmail.com
Fri Apr 27 05:54:31 PDT 2012
On Friday, 27 April 2012 at 11:23:06 UTC, Dmitry Olshansky wrote:
> On 27.04.2012 15:15, Rene Zwanenburg wrote:
>> Since an OpenGL context is owned by one thread, any OpenGL
>> calls made
>> from other threads will fail. I've wrapped OpenGL 'objects' in
>> D classes
>> to automate destruction of the underlying object:
>>
> How about using structs for GL objects? It's not like you have
> a hierarchy or interfaces in there.
>
> [snip]
True, but what would using structs do to fix the problem?
The reason I'm using (final) classes is because a resource can be
used by multiple objects. If two meshes use the same texture, I
don't want to load that texture twice. Reference to class is
cleaner than pointer to struct.
More information about the Digitalmars-d-learn
mailing list