C# CF v.1.1 Monitors and the Wait()-method?

C# CF v.1.1 Monitors and the Wait()-method?

Post by waggerdagg » Tue, 22 Nov 2005 03:54:28


Hey!

I have a question regarding C# CF v 1.1 which I'm developing in at the
moment. I hope that someone have time to read this and perhaps give a
some pointers =)

My problem is the abscence of the Monitor.Wait() and
Monitor.Pulse()/PulseAll().
I'm using threads in my application, and one of these Threads are
going to run a method called something like
void getData()
The thing is that this Thread should be locked until data is
available, and the method getData is therefore placed in a Monitor,
something like this:

public SomeThing getData()
{
while(data.Count < 1)
{
Monitor.Wait(samLock);
}
// etc...
}

How can I lock a Thread in CF? I've though about Mutex/Semaphore but
can't figure out how to allow a Thread to Wait, do it's thing and then
go back to Wait() again?

I'd appreciate any help I can get!
Regards,
Ted Ekeroth
Sweden
 
 
 

C# CF v.1.1 Monitors and the Wait()-method?

Post by Daniel Mot » Tue, 22 Nov 2005 04:05:24

See the Threading namespace in SDF from OpenNETCF.

Also see this for an example of ManualResetEvent that may be what you are
after:
http://www.yqcomputer.com/

Cheers
Daniel