我对并发编程有点新意,并试图了解使用Monitor.Pulse和Monitor.Wait的好处.
MSDN的示例如下:
class MonitorSample
{
const int MAX_LOOP_TIME = 1000;
Queue m_smplQueue;
public MonitorSample()
{
m_smplQueue = new Queue();
}
public void FirstThread()
{
int counter = 0;
lock(m_smplQueue)
{
while(counter < MAX_LOOP_TIME)
{
//Wait, if the queue is busy.
Monitor.Wait(m_smplQueue);
//Push one element.
m_smplQueue.Enqueue(counter);
//Release the waiting thread.
Monitor.Pulse(m_smplQueue);
counter++;
}
}
}
public void SecondThread()
{
lock(m_smplQueue)
{
//Release the waiting thread.
Monitor.Pulse(m_smplQueue);
//Wait in the loop, while the queue is busy.
//Exit on the time-out when the …Run Code Online (Sandbox Code Playgroud) 我试图启动我的第一个ASP.NET MVC程序,并希望修改项目的某些部分.
当我尝试更改页面主体的背景颜色时,我转到Site.css文件并将颜色更改为#ffffff.当我重建程序时,颜色保持不变,我发现改变它的唯一方法是删除它并将其加载回项目.
在我看来好像我错过了一些非常基本的东西,你能帮助我吗?