This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [win32] Fix suspend count handling


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]