thread.d "Unable to load thread context"

Sean Kelly sean at invisibleduck.org
Wed Jun 29 21:45:42 PDT 2011


On Jun 29, 2011, at 10:00 AM, Benjamin Thaut wrote:

> Am 29.06.2011 17:52, schrieb Sean Kelly:
>> I really want to fix this--the current patch is frustrating to deal with--but I don't have the time yet.
>> 
>> Sent from my iPhone
>> 
>> On Jun 29, 2011, at 12:40 AM, "Daniel Murphy"<yebblies at nospamgmail.com>  wrote:
>> 
>>> "Benjamin Thaut"<code at benjamin-thaut.de>  wrote in message
>>> news:iud7qf$16jf$1 at digitalmars.com...
>>>> I just build dmd, druntime and phobos fromt the latest git revision (as
>>>> druntime does not build with dmd 2.053). The game does build with it, but
>>>> as soon as it starts a exception gets thrown in the GC which does not get
>>>> cought by any of my catch blocks.
>>>> Maybe I did something wrong building dmd, is there a guide somewhere?
>>>> 
>>> 
>>> Recent changes have made allocating memory from the GC while a collection is
>>> running (eg inside a class destructor) throw an exception.  Is it possible
>>> your code is doing this?
>>> 
>>> 
> If I manually merge your fix into the thread.d of the 2.053 runtime (change m to __gshared in slock) the issue still exsits. After a while the game will stop with "unable to load thread context".

Just for kicks, rewrite the GetThreadContext call as this and see if it works in 2.053:

            for( int i = 0; !GetThreadContext( t.m_hndl, &context ); i++ )
            {
                if( i > 99 )
                    throw new ThreadException( "Unable to load thread context" );
                Thread.yield();
            }



More information about the Digitalmars-d mailing list