Writing game engine in C++, considering switching to D
francesco.cattoglio via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 20 06:49:03 PST 2015
On Friday, 20 February 2015 at 13:44:04 UTC, ponce wrote:
> On Friday, 20 February 2015 at 13:04:51 UTC, John Colvin wrote:
>> On Friday, 20 February 2015 at 09:57:48 UTC,
>> francesco.cattoglio wrote:
>>> (e.g: if the GC calls any OpenGL function, you get a "nice"
>>> crash since OpenGL is not multithread-aware by default).
>>
>> Really? I don't see this in my projects. The GC stops the
>> world, so there shouldn't be any races.
>
> Not a race.
> An OpenGL contect can only active in one thread at once. If the
> GC calls a destructor from a thread which doesn't have that
> context active, it will probably crash.
Exactly. Unless you do some special work yourself, you can't call
OpenGL function from a different thread.
It's not a real D problem, in fact, D is probably doing the right
thing when it comes to Thread Local Storage and such. It is more
of an OpenGL limitation.
This is also the reason I can't wait to see OpenGL Next, since
there were also promises of "far better multithread support".
More information about the Digitalmars-d
mailing list