[win32] Fix suspend count handling

Lerele lerele@champenstudios.com
Sat Nov 24 17:50:00 GMT 2007


Pedro Alves escribió:
> Lerele wrote:
>
> > This paragraph
>> makes me ask, maybe the problems you talk about were due to some 
>> other reason, and not just about using SuspendThread only? Or are you 
>> 100% sure it's because of that specific function?
>>
>
> Its not the function per se that's the problem.  It's that when we
> suspend a thread it may be holding some internal lock, or
> some such.  Calling the same function or another function that accesses
> the same internal resources from another thread may violate what
> was expected internally.  My experience on porting gdbserver to WinCE,
> showed me that on WinCE at least, SuspendThread will not immediatelly
> suspend the thread -- that probably means that the OS only stops the
> threads on safe points.  That a look here [1].  It may be that
> earlier versions of Windows had bugs that made that unsafe.
> (Windows CE source code is available, but I won't touch it with a
> ten-meter [2] pole.)
>
>
> [1]
> http://sourceware.org/ml/gdb-patches/2007-11/msg00220.html
> -- Yes not perfect, I know.
>
> [2]
> I think metric.
>

It's actually hard to believe those functions do not work as expected, 
especially because MSDN docs specifically state using SuspendThread 
before GetThreadContext, asuming the latter should work after the 
former, but of course anything is possible.

If that is true, it's useless of course to use them functions.





More information about the Gdb-patches mailing list