0

Hi

I'm writing an application which basically takes images from pixelink camera and does some calculations on them.

I need to monitor the status of the system for 2 things: presence of camera and connection to SQL server.

I also have a preview feature.

Right now it's all being done by a two timers (one for preview and second for status) which run threads for status/preview.

On a decent Core 2 duo everything is quite smooth but on single core CPU responssivnes of the application is not so good (sometimes main form is frozen for couple of seconds).

How should i do those 2 processes so that they don't have an impact on application performance?

Thx for any info!

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Jugortha
0

You can use the lock keyword provided by C# to avoid the critical sections code
You do a so to avoid conflicts between processes or threads unsafe in your case

private Object Critic = new Object();
//Safe code
.............
lock(Critic)
{
//Here you can put the critical block of code
............
}
//Safe code
..............

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.