thread.d "Unable to load thread context"

Benjamin Thaut code at benjamin-thaut.de
Thu Jun 30 02:40:17 PDT 2011


Am 30.06.2011 06:45, schrieb Sean Kelly:
> 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();
>              }
>

The for loop seems to have fixed the issue, at least I'm not able to 
reproduce it easily any more. I'm going to be able to tell you tomorrow 
if the issue is fixed completely or not.

Does any access to the GC cause a Exception to be thrown? I mean even a 
removeRange call?

-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list