C++ 隊列queue中的一段玄學代碼
阿新 • • 發佈:2017-05-08
原因 gin p s emp printf empty ont ffffff pro
代碼:
- 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
目前還未找到原因,找到原因我會更新。
C++ 隊列queue中的一段玄學代碼