OS中 生产消费者问题(同步问题)请老师们提点 提点下 小弟先谢了!!!!
我先在的问题是 当资源栈满时这时生产者线程就会等待.空时消费者线程也会等待.. 但是在最后等待的线程不会再被唤醒..我用的是datagridview存放每一个操作者的步骤.但就是不会在显示等待的线程应该被唤醒再继续操作..
请老师指点指点谢谢
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace spc_w1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SharedControl();// 用来生成线程 和执行的.
sreen1(ShareArea.Dt);
}
public void sreen1(DataTable dt)
{
dataGridView1.AutoGenerateColumns = false;
dataGridView1.Columns[ "z1 "].DataPropertyName = "1 ";
dataGridView1.Columns[ "z2 "].DataPropertyName = "2 ";
dataGridView1.Columns[ "z3 "].DataPropertyName = "3 ";
dataGridView1.Columns[ "z4 "].DataPropertyName = "4 ";
dataGridView1.Columns[ "z5 "].DataPropertyName = "5 ";
dataGridView1.Columns[ "z6 "].DataPropertyName = "6 ";
dataGridView1.Columns[ "z7 "].DataPropertyName = "7 ";
dataGridView1.Columns[ "z8 "].DataPropertyName = "8 ";
dataGridView1.Columns[ "z9 "].DataPropertyName = "9 ";
dataGridView1.DataSource = dt;