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.