thread.d "Unable to load thread context"

Eric Poggel (JoeCoder) dnewsgroup2 at yage3d.net
Thu Jun 30 16:31:58 PDT 2011


On 6/30/2011 3:05 PM, Sean Kelly wrote:
> On Jun 30, 2011, at 2:40 AM, Benjamin Thaut wrote:
>
>> Am 30.06.2011 06:45, schrieb Sean Kelly:
>>> On Jun 29, 2011, at 10:00 AM, Benjamin Thaut wrote:
>>>> 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.
>
> Cool.  I've applied the change to druntime.
>
>> Does any access to the GC cause a Exception to be thrown? I mean even a removeRange call?
>
> malloc, realloc, extend, reserve, addRoot, and addRange.  I think that's it.

This makes me wonder how many other such hacks like this are in 
DRuntime.  If this problem happens once every 30 minutes, then I suppose 
this decreases it to once every 30^100 minutes (which is older than the 
universe).


More information about the Digitalmars-d mailing list