Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference Between Monitor & Lock?

What's the difference between a monitor and a lock?

If a lock is simply an implementation of mutual exclusion, then is a monitor simply a way of making use of the waiting time inbetween method executions?

A good explanation would be really helpful thanks....

regards

like image 589
Goober Avatar asked May 23 '09 18:05

Goober


People also ask

What is difference between TV and monitor?

Televisions have a viewing angle of about 160 degrees. Since monitors have a higher resolution, the quality of images is very high-quality, accurate, and sharp. Since televisions have a lower resolution, the image quality is much smoother and appealing to the viewers' eyes. Monitors experience less input lag.

What are the 5 types of monitor?

There are five types of monitors CRT(Cathode Ray tube), LCD (Liquid Crystal Display), LED (Liquid Emitting Diode), OLED (Organic Light Emitting Diode), and Plasma Monitor all are used in televisions or computer desktops.

Which is better monitor or TV?

Monitors usually have lower input lag, higher refresh rates and faster response time than TVs, which make them a better choice for gaming (there are exceptions, such as OLED TVs). On the other side, TVs are larger and more affordable, so they are fantastic for watching movies and TV shows, as well as console gaming.


1 Answers

For example in C# .NET a lock statement is equivalent to:

Monitor.Enter(object);
try
{
    // Your code here...
}
finally
{
    Monitor.Exit(object);
}

However, keep in mind that Monitor can also Wait() and Pulse(), which are often useful in complex multithreading situations.

Edit: In later versions of the .NET framework, this was changed to:

bool lockTaken = false;
try
{
    Monitor.Enter(object, ref lockTaken);
    // Your code here...
}
finally
{
    if (lockTaken)
    {
        Monitor.Exit(object);
    }
}
like image 143
John Gietzen Avatar answered Oct 05 '22 08:10

John Gietzen