[Mono-osx] Mono OSX thread

sebi77 balazs.sebestyen at webcamlaboratory.com
Mon Jan 3 08:31:36 EST 2011


When I move the mouse over the window, the program runs much faster (cc. 3
times). (Or refreshes more frequently). This is a real time webcam .Net/Mono
application running on a MacBook. On Windows works perfectly. The code:

Thread t = new Thread(Foo);
t.Priority = ThreadPriority.Highest; // doesn't do anything, 
t.Start();
...
delegate void SetInt(int k);
void Foo()
{
    int k = 0;
    while (true)
    {
        ++k; 
        BeginInvoke(new SetInt(Bar), k);   
    }
}
void Bar(int k)
{
    Graphics.FromImage(pictureBox1.Image).DrawString(k.ToString(),
        System.Fonts.DefaultFont, Brushes.Red, 0, 0);
    pictureBox1.Invalidate();
}

The real code is a bit more complicated, eg. watches reentrance in Bar(). I
know that Thread.Priority is not implemented in Mono, but must be a
solution, otherwise every real-time application would be unusable in
Mono+OSX. I don't want extra priority for my app, just as much as it has
when the mouse is moving.
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Mono-OSX-thread-tp3171952p3171952.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list