Is there any replacement for these function on the CF2?
I have a critical code in a high prioirity thread that I want to finishe
executing without the interruption of other
threads.
Thanks.
Rick D.
Contractor
Monitor.Enter/Exit might be what you need, but it simply prevents 2 threads
from running the same piece of code at the same time (like a
CRITICAL_SECTION in native code). That also doesn't really sound like what
you want based on your description.
I *think* (and again, your requirement is a little unclear) what you want is
to simply increase the priority of your "critical" thread so it can't be
pre-empted by another thread. If it's a long-running thread, altering the
quantum might be useful as well (though not nearly as simple as changing the
priority).
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Moshe Peleg" <mpe...@softstart.co.il> wrote in message
news:uJpL7Mmw...@TK2MSFTNGP04.phx.gbl...
The priority of this thread is set to highest.
Does it mean that lower priority threads will not interrupt until it sleep ?
"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:uO0nsemw...@TK2MSFTNGP06.phx.gbl...
The communication thread fills a buffer. I don't want it to be read by other
threads until I finish filling it.
"Moshe Peleg" <mpe...@softstart.co.il> wrote in message
news:uJpL7Mmw...@TK2MSFTNGP04.phx.gbl...
Preempt is the term you want to use, not interrupt. In Windows CE (and in
computing in general) an interrupt is a totally different thing and using
that term is going to cause confusion.
It means the scheduler will not preempt the thread to run any lower priority
thread (unless a lower priority thread needs to be promoted to prevent an
inversion and deadlock). A same-priority thread could preempt you if your
thread takes longer than the system-defined quantum period (50ms is the
default in CE).
In answer to your other message, it's not clear what Highest actually
corresponds to at the operating system level. If it should happen to
correspond to a thread priority of 0 at the OS level, which is very
doubtful, the thread will execute until it either exits or blocks on some OS
call. If it actually maps to some other high, but not absolutely highest,
OS priority, it will execute, when it's not blocked, as long as there is no
other ready-to-execute thread of the same or higher priority.
Paul T.
"Moshe Peleg" <mpe...@softstart.co.il> wrote in message
news:OxZ1Krmw...@TK2MSFTNGP02.phx.gbl...
And I agree, he needs a thread sync object, not a priority hack.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:OYVPF5mw...@TK2MSFTNGP02.phx.gbl...