代码:
- mtx.lock();
- printf("node %d push localW prepared,and local flag=%d,clock=%d\n",procID,localW.getFlag(),localW.getClock());
- printf("localQ is empty:%s\n",localQ.empty()?"true":"false");
- localQ.push(localW);
- printf("node %d push localW successfully,and front flag=%d,clock:%d\n",procID,localQ.front().getFlag(),localQ.front().getClock());
- printf("node %d push localW successfully,and local flag=%d,clock:%d\n",procID,localW.getFlag(),localW.getClock());
- mtx.unlock();
输出的结果就神奇了,给大家瞅瞅:
node 2 push localW prepared,and local flag=0,clock=0
localQ is empty:true
node 2 push localW successfully,and front flag=4,clock:24
node 2 push localW successfully,and local flag=0,clock:0
目前还未找到原因,找到原因我会更新。
时间: 2024-10-07 00:08:04