[Mono-devel-list] Re: Threading model
Paul
paul at all-the-johnsons.co.uk
Fri Aug 5 12:28:49 EDT 2005
Hi,
Thanks for the heads up on that. I've looked at the C++ version at
http://samples.gotdotnet.com/quickstart/util/srcview.aspx?lbLangPref=CP&path=/quickstart/howto/Samples/WinForms/ThreadMarshal/ThreadMarshal.src
but I'm not sure if I've got this right.
My thread code looks like this
public void run()
{
while (true)
{
try
{
Monitor.Enter(this);
t1.Text = (++count1).ToString();
t2.Text = (++count2).ToString();
}
finally
{
Monitor.Exit(this);
}
Thread.Sleep(500);
}
}
would I be correct in thinking that I would need to change this to
MethodInvoker mi = new MethodInvoker(this, Monitor.Enter);
while (true)
{
this.BeginInvoke(mi);
t1.Text = (++count1).ToString();
t2.Text = (++count2).ToString();
Thread.Sleep(500);
}
Problem is, this doesn't quite seem right. Also, how do I change this if
I use lock()?
TTFN
Paul
--
"Some people will do anything for a woman in uniform" - The Doctor -
Unregenerate (Big Finish audio)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050805/0428f061/attachment.bin
More information about the Mono-devel-list
mailing list