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

W

waggerdagger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top