亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? readme.cv

?? pthread source code,you can compile directly
?? CV
?? 第 1 頁 / 共 5 頁
字號:
mtxExternal - mutex or CSmtxUnblockLock - mutex or CSnWaitersGone - intnWaitersBlocked - intnWaitersToUnblock - intwait( timeout ) {  [auto: register int result          ]     // error checking omitted  [auto: register int nSignalsWasLeft ]  [auto: register int nWaitersWasGone ]  wait( hevBlockLock,INFINITE );  nWaitersBlocked++;  set_event( hevBlockLock );  unlock( mtxExternal );  bTimedOut = wait( hevBlockQueue,timeout );  lock( mtxUnblockLock );  if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) {    if ( bTimeout ) {                       // timeout (or canceled)      if ( 0 != nWaitersBlocked ) {        nWaitersBlocked--;        nSignalsWasLeft = 0;                // do not unblock next waiterbelow (already unblocked)      }      else {        nWaitersGone = 1;                   // spurious wakeup pending!!      }    }    if ( 0 == --nWaitersToUnblock )      if ( 0 != nWaitersBlocked ) {        set_event( hevBlockLock );          // open the gate        nSignalsWasLeft = 0;                // do not open the gate belowagain      }      else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {        nWaitersGone = 0;      }    }  }  else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spuriousevent :-)    wait( hevBlockLock,INFINITE );    nWaitersBlocked -= nWaitersGone;        // something is going on here -test of timeouts? :-)    set_event( hevBlockLock );    nWaitersGone = 0;  }  unlock( mtxUnblockLock );  if ( 1 == nSignalsWasLeft ) {    if ( 0 != nWaitersWasGone ) {      reset_event( hevBlockQueue );         // better now than spuriouslater    }    set_event( hevBlockLock );              // open the gate  }  else if ( 0 != nSignalsWasLeft ) {    set_event( hevBlockQueue );             // unblock next waiter  }  lock( mtxExternal );  return ( bTimedOut ) ? ETIMEOUT : 0;}signal(bAll) {  [auto: register int result ]  lock( mtxUnblockLock );  if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!    if ( 0 == nWaitersBlocked ) { // NO-OP      return unlock( mtxUnblockLock );    }    if (bAll) {      nWaitersToUnblock += nWaitersBlocked;      nWaitersBlocked = 0;    }    else {      nWaitersToUnblock++;      nWaitersBlocked--;    }    unlock( mtxUnblockLock );  }  else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!    wait( hevBlockLock,INFINITE ); // close the gate    if ( 0 != nWaitersGone ) {      nWaitersBlocked -= nWaitersGone;      nWaitersGone = 0;    }    if (bAll) {      nWaitersToUnblock = nWaitersBlocked;      nWaitersBlocked = 0;    }    else {      nWaitersToUnblock = 1;      nWaitersBlocked--;    }    unlock( mtxUnblockLock );    set_event( hevBlockQueue );  }  else { // NO-OP    unlock( mtxUnblockLock );  }  return result;}---------- Algorithm 8d / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ALL ------given:hevBlockLock - auto-reset eventhevBlockQueueS - auto-reset event  // for signalshevBlockQueueB - manual-reset even // for broadcastsmtxExternal - mutex or CSmtxUnblockLock - mutex or CSeBroadcast - int                   // 0: no broadcast, 1: broadcast, 2:broadcast after signal(s)nWaitersGone - intnWaitersBlocked - intnWaitersToUnblock - intwait( timeout ) {  [auto: register int result          ]     // error checking omitted  [auto: register int eWasBroadcast   ]  [auto: register int nSignalsWasLeft ]  [auto: register int nWaitersWasGone ]  wait( hevBlockLock,INFINITE );  nWaitersBlocked++;  set_event( hevBlockLock );  unlock( mtxExternal );  bTimedOut = waitformultiple( hevBlockQueueS,hevBlockQueueB,timeout,ONE );  lock( mtxUnblockLock );  if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) {    if ( bTimeout ) {                       // timeout (or canceled)      if ( 0 != nWaitersBlocked ) {        nWaitersBlocked--;        nSignalsWasLeft = 0;                // do not unblock next waiterbelow (already unblocked)      }      else if ( 1 != eBroadcast ) {        nWaitersGone = 1;      }    }    if ( 0 == --nWaitersToUnblock ) {      if ( 0 != nWaitersBlocked ) {        set_event( hevBlockLock );           // open the gate        nSignalsWasLeft = 0;                 // do not open the gate belowagain      }      else {        if ( 0 != (eWasBroadcast = eBroadcast) ) {          eBroadcast = 0;        }        if ( 0 != (nWaitersWasGone = nWaitersGone ) {          nWaitersGone = 0;        }      }    }    else if ( 0 != eBroadcast ) {      nSignalsWasLeft = 0;                  // do not unblock next waiterbelow (already unblocked)    }  }  else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spuriousevent :-)    wait( hevBlockLock,INFINITE );    nWaitersBlocked -= nWaitersGone;        // something is going on here -test of timeouts? :-)    set_event( hevBlockLock );    nWaitersGone = 0;  }  unlock( mtxUnblockLock );  if ( 1 == nSignalsWasLeft ) {    if ( 0 != eWasBroadcast ) {      reset_event( hevBlockQueueB );    }    if ( 0 != nWaitersWasGone ) {      reset_event( hevBlockQueueS );        // better now than spuriouslater    }    set_event( hevBlockLock );              // open the gate  }  else if ( 0 != nSignalsWasLeft ) {    set_event( hevBlockQueueS );            // unblock next waiter  }  lock( mtxExternal );  return ( bTimedOut ) ? ETIMEOUT : 0;}signal(bAll) {  [auto: register int    result        ]  [auto: register HANDLE hevBlockQueue ]  lock( mtxUnblockLock );  if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!    if ( 0 == nWaitersBlocked ) { // NO-OP      return unlock( mtxUnblockLock );    }    if (bAll) {      nWaitersToUnblock += nWaitersBlocked;      nWaitersBlocked = 0;      eBroadcast = 2;      hevBlockQueue = hevBlockQueueB;    }    else {      nWaitersToUnblock++;      nWaitersBlocked--;      return unlock( mtxUnblockLock );    }  }  else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!    wait( hevBlockLock,INFINITE ); // close the gate    if ( 0 != nWaitersGone ) {      nWaitersBlocked -= nWaitersGone;      nWaitersGone = 0;    }    if (bAll) {      nWaitersToUnblock = nWaitersBlocked;      nWaitersBlocked = 0;      eBroadcast = 1;      hevBlockQueue = hevBlockQueueB;    }    else {      nWaitersToUnblock = 1;      nWaitersBlocked--;      hevBlockQueue = hevBlockQueueS;    }  }  else { // NO-OP    return unlock( mtxUnblockLock );  }  unlock( mtxUnblockLock );  set_event( hevBlockQueue );  return result;}---------------------- Forwarded by Alexander Terekhov/Germany/IBM on02/21/2001 09:13 AM ---------------------------Alexander Terekhov02/20/2001 04:33 PMTo:   Louis Thomas <lthomas@arbitrade.com>cc:From: Alexander Terekhov/Germany/IBM@IBMDESubject:  RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio      n questionsImportance:    Normal>Sorry, gotta take a break and work on something else for a while.>Real work>calls, unfortunately. I'll get back to you in two or three days.ok. no problem. here is some more stuff for pauses you might havein between :)---------- Algorithm 7d / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ALL ------given:hevBlockLock - auto-reset eventhevBlockQueueS - auto-reset event  // for signalshevBlockQueueB - manual-reset even // for broadcastsmtxExternal - mutex or CSmtxUnblockLock - mutex or CSbBroadcast - intnWaitersGone - intnWaitersBlocked - intnWaitersToUnblock - intwait( timeout ) {  [auto: register int result          ]     // error checking omitted  [auto: register int bWasBroadcast   ]  [auto: register int nSignalsWasLeft ]  wait( hevBlockLock,INFINITE );  nWaitersBlocked++;  set_event( hevBlockLock );  unlock( mtxExternal );  bTimedOut = waitformultiple( hevBlockQueueS,hevBlockQueueB,timeout,ONE );  lock( mtxUnblockLock );  if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) {    if ( bTimeout ) {                       // timeout (or canceled)      if ( 0 != nWaitersBlocked ) {        nWaitersBlocked--;        nSignalsWasLeft = 0;                // do not unblock next waiterbelow (already unblocked)      }      else if ( !bBroadcast ) {        wait( hevBlockQueueS,INFINITE );    // better now than spuriouslater      }    }    if ( 0 == --nWaitersToUnblock ) {      if ( 0 != nWaitersBlocked ) {        if ( bBroadcast ) {          reset_event( hevBlockQueueB );          bBroadcast = false;        }        set_event( hevBlockLock );           // open the gate        nSignalsWasLeft = 0;                 // do not open the gate belowagain      }      else if ( false != (bWasBroadcast = bBroadcast) ) {        bBroadcast = false;      }    }    else {      bWasBroadcast = bBroadcast;    }  }  else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spuriousevent :-)    wait( hevBlockLock,INFINITE );    nWaitersBlocked -= nWaitersGone;        // something is going on here -test of timeouts? :-)    set_event( hevBlockLock );    nWaitersGone = 0;  }  unlock( mtxUnblockLock );  if ( 1 == nSignalsWasLeft ) {    if ( bWasBroadcast ) {      reset_event( hevBlockQueueB );    }    set_event( hevBlockLock );              // open the gate  }  else if ( 0 != nSignalsWasLeft && !bWasBroadcast ) {    set_event( hevBlockQueueS );            // unblock next waiter  }  lock( mtxExternal );  return ( bTimedOut ) ? ETIMEOUT : 0;}signal(bAll) {  [auto: register int    result        ]  [auto: register HANDLE hevBlockQueue ]  lock( mtxUnblockLock );  if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!    if ( 0 == nWaitersBlocked ) { // NO-OP      return unlock( mtxUnblockLock );    }    if (bAll) {      nWaitersToUnblock += nWaitersBlocked;      nWaitersBlocked = 0;      bBroadcast = true;      hevBlockQueue = hevBlockQueueB;    }    else {      nWaitersToUnblock++;      nWaitersBlocked--;      return unlock( mtxUnblockLock );    }  }  else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!    wait( hevBlockLock,INFINITE ); // close the gate    if ( 0 != nWaitersGone ) {      nWaitersBlocked -= nWaitersGone;      nWaitersGone = 0;    }    if (bAll) {      nWaitersToUnblock = nWaitersBlocked;      nWaitersBlocked = 0;      bBroadcast = true;      hevBlockQueue = hevBlockQueueB;    }    else {      nWaitersToUnblock = 1;      nWaitersBlocked--;      hevBlockQueue = hevBlockQueueS;    }  }  else { // NO-OP    return unlock( mtxUnblockLock );  }  unlock( mtxUnblockLock );  set_event( hevBlockQueue );  return result;}----------------------------------------------------------------------------Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio     n questionsDate: Mon, 26 Feb 2001 22:20:12 -0600From: Louis Thomas <lthomas@arbitrade.com>To: "'TEREKHOV@de.ibm.com'" <TEREKHOV@de.ibm.com>CC: rpj@ise.canberra.edu.au, Thomas Pfaff <tpfaff@gmx.net>,     Nanbor Wang     <nanbor@cs.wustl.edu>Sorry all. Busy week.> this insures the fairness> which POSIX does not (e.g. two subsequent broadcasts - the gate doesinsure> that first wave waiters will start the race for the mutex before waiters> from the second wave - Linux pthreads process/unblock both waves> concurrently...)I'm not sure how we are any more fair about this than Linux. We certainlydon't guarantee that the threads released by the first broadcast will getthe external mutex before the threads of the second wave. In fact, it ispossible that those threads will never get the external mutex if there isenough contention for it.> e.g. i was thinking about implementation with a pool of> N semaphores/counters [...]I considered that too. The problem is as you mentioned in a). You reallyneed to assign threads to semaphores once you know how you want to wake themup, not when they first begin waiting which is the only time you can assignthem.> well, i am not quite sure that i've fully understood your scenario,Hmm. Well, it think it's an important example, so I'll try again. First, wehave thread A which we KNOW is waiting on a condition. As soon as it becomesunblocked for any reason, we will know because it will set a flag. Since theflag is not set, we are 100% confident that thread A is waiting on thecondition. We have another thread, thread B, which has acquired the mutexand is about to wait on the condition. Thus it is pretty clear that at anypoint, either just A is waiting, or A and B are waiting. Now thread C comesalong. C is about to do a broadcast on the condition. A broadcast isguaranteed to unblock all threads currently waiting on a condition, right?Again, we said that either just A is waiting, or A and B are both waiting.So, when C does its broadcast, depending upon whether B has started waitingor not, thread C will unblock A or unblock A and B. Either way, C mustunblock A, right?Now, you said anything that happens is correct so long as a) "a signal isnot lost between unlocking the mutex and waiting on the condition" and b) "athread must not steal a signal it sent", correct? Requirement b) is easy tosatisfy: in this scenario, thread C will never wait on the condition, so itwon't steal any signals.  Requirement a) is not hard either. The only way wecould fail to meet requirement a) in this scenario is if thread B wasstarted waiting but didn't wake up because a signal was lost. This will nothappen.Now, here is what happens. Assume thread C beats thread B. Thread C looks tosee how many threads are waiting on the condition. Thread C sees just onethread, thread A, waiting. It does a broadcast waking up just one threadbecause just one thread is waiting. Next, before A can become unblocked,thread B begins waiting. Now there are two threads waiting, but only onewill be unblocked. Suppose B wins. B will become unblocked. A will notbecome unblocked, because C only unblocked one thread (sema_post cond, 1).So at the end, B finishes and A remains blocked.We have met both of your requirements, so by your rules, this is anacceptable outcome. However, I think that the spec says this is anunacceptable outcome! We know for certain that A was waiting and that C dida broadcast, but A did not become unblocked! Yet, the spec says that abroadcast wakes up all waiting threads. This did not happen. Do you agreethat this shows your rules are not strict enough?> and what about N2? :) this one does allow almost everything.Don't get me started about rule #2. I'll NEVER advocate an algorithm thatuses rule 2 as an excuse to suck!> but it is done (decrement)under mutex protection - this is not a subject> of a race condition.You are correct. My mistake.> i would remove "_bTimedOut=false".. after all, it was a real timeout..I disagree. A thread that can't successfully retract its waiter status can'treally have timed out. If a thread can't return without executing extra codeto deal with the fact that someone tried to unblock it, I think it is a pooridea to pretend wedidn't realize someone was trying to signal us. After all, a signal is moreimportant than a time out.> 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久草这里只有精品视频| 7777女厕盗摄久久久| 久久精品视频一区二区| 极品美女销魂一区二区三区| 日韩欧美一区二区不卡| 石原莉奈在线亚洲二区| 欧美一区二区精品在线| 奇米四色…亚洲| 日韩欧美国产一区二区三区| 久久国产尿小便嘘嘘尿| 久久久久一区二区三区四区| 国产69精品久久99不卡| 亚洲欧美日韩电影| 欧美日韩一级视频| 经典一区二区三区| 尤物av一区二区| 日韩一区二区视频在线观看| 久99久精品视频免费观看| 国产欧美精品区一区二区三区| av亚洲精华国产精华| 亚洲一区二区视频| 久久蜜桃香蕉精品一区二区三区| 成人黄色网址在线观看| 日韩精品一二三| 国产精品少妇自拍| 日韩视频免费直播| 在线观看不卡一区| 粉嫩一区二区三区在线看| 视频一区欧美日韩| 亚洲精品成人天堂一二三| 久久久久久夜精品精品免费| 欧洲亚洲国产日韩| 99国产欧美久久久精品| 久久电影网站中文字幕| 亚洲影院在线观看| 亚洲视频香蕉人妖| 国产清纯白嫩初高生在线观看91| 日韩一区二区在线观看| 欧美三区在线视频| 在线精品视频小说1| 91免费看`日韩一区二区| 国内精品久久久久影院一蜜桃| 视频一区视频二区中文字幕| 亚洲www啪成人一区二区麻豆| 亚洲欧美欧美一区二区三区| 亚洲欧洲在线观看av| 日韩毛片一二三区| 国产精品乱码久久久久久| 国产精品素人视频| 国产精品夫妻自拍| 亚洲欧美另类久久久精品| 国产亚洲一本大道中文在线| 久久久久国产精品麻豆 | 一区二区三区不卡视频在线观看 | 精品日韩在线观看| 欧美v国产在线一区二区三区| 日韩免费观看高清完整版 | www.亚洲在线| 欧美影院一区二区| 欧美一三区三区四区免费在线看| 91精品久久久久久久99蜜桃| 欧美大肚乱孕交hd孕妇| 国产日韩影视精品| 一区二区三区日韩| 极品少妇一区二区| 日本久久电影网| 日韩丝袜情趣美女图片| 国产精品乱码一区二三区小蝌蚪| 亚洲一区二区不卡免费| 国产伦精品一区二区三区视频青涩 | 国产乱码精品一区二区三 | 紧缚捆绑精品一区二区| 99精品国产视频| 亚洲精品一区二区三区香蕉| 亚洲人123区| 国产精品一品二品| 欧美放荡的少妇| 亚洲精品一卡二卡| 国产精品影视网| 3751色影院一区二区三区| 国产精品蜜臀av| 国产精品一二三四区| 欧美不卡一二三| 五月婷婷综合网| 91成人免费在线| 亚洲私人黄色宅男| 成人h动漫精品一区二| 精品国产乱子伦一区| 蜜桃91丨九色丨蝌蚪91桃色| 欧美三电影在线| 亚洲一卡二卡三卡四卡| 91豆麻精品91久久久久久| 亚洲天堂精品视频| 成人黄色小视频| 亚洲免费高清视频在线| 91无套直看片红桃| 亚洲欧美日韩系列| 欧洲一区在线电影| 免费在线成人网| 欧美不卡一二三| 国产福利不卡视频| 日韩一区欧美一区| 欧美色图免费看| 日本不卡免费在线视频| 日韩精品一区二区三区蜜臀 | 亚洲国产欧美日韩另类综合| 在线成人免费视频| 日本特黄久久久高潮| 久久网站热最新地址| 99久久精品情趣| 一区二区视频在线看| 777久久久精品| 国产91综合一区在线观看| 一区二区三区欧美视频| 这里只有精品电影| 成人福利视频网站| 美女被吸乳得到大胸91| 中文字幕亚洲欧美在线不卡| 欧美色网一区二区| 国产乱理伦片在线观看夜一区| 国产精品拍天天在线| 欧美日韩一级视频| 国产福利一区二区三区| 亚瑟在线精品视频| 亚洲视频电影在线| 欧美xxxxx牲另类人与| 欧美日韩免费一区二区三区视频| 国产成人亚洲综合a∨猫咪| 亚洲6080在线| 亚洲日本在线观看| 国产婷婷色一区二区三区| 欧美人伦禁忌dvd放荡欲情| 粉嫩一区二区三区性色av| 蜜桃一区二区三区在线观看| 亚洲黄色小视频| 国产精品国模大尺度视频| 精品国产一区二区三区四区四 | 男女视频一区二区| 亚洲午夜在线电影| 国产精品国模大尺度视频| 国产精品久久久久精k8 | 国产区在线观看成人精品| 久久蜜臀中文字幕| 亚洲欧美日韩国产手机在线 | 欧美手机在线视频| 欧美高清dvd| 777奇米成人网| 精品国产乱码久久| 国产亚洲午夜高清国产拍精品| 欧美精品一区二区在线观看| 久久这里只精品最新地址| 日韩美女在线视频| www精品美女久久久tv| 中文字幕av资源一区| 一区二区三区在线免费播放| 亚洲男人的天堂在线观看| 亚洲综合色成人| 久久精品免费观看| 成人动漫一区二区在线| 色综合久久中文综合久久牛| 欧美日韩精品一区二区三区| 日韩一区二区电影网| 国产人成亚洲第一网站在线播放 | 9久草视频在线视频精品| 91久久免费观看| 日韩午夜精品视频| 中文字幕亚洲区| 蜜臀va亚洲va欧美va天堂 | 国产精品一二三区| 欧美日韩欧美一区二区| 国产三级久久久| 午夜av一区二区| av色综合久久天堂av综合| 日韩免费一区二区| 亚洲自拍偷拍网站| 国产精品一区二区在线看| 欧美日韩精品一二三区| 国产精品久久久久久久久久久免费看| 亚洲一二三四在线| 91蜜桃在线免费视频| 欧美国产成人精品| 国产一区二区调教| 在线不卡的av| 亚洲一级二级在线| 一本到高清视频免费精品| 久久嫩草精品久久久精品| 日韩成人一级片| 色94色欧美sute亚洲13| 中文字幕欧美激情| 国产在线精品视频| 久久综合久久鬼色| 国产九九视频一区二区三区| 日韩免费高清av| 精品一区二区精品| 精品国产髙清在线看国产毛片| 久久精品国产77777蜜臀| 精品国产髙清在线看国产毛片| 韩国在线一区二区| 国产精品国产三级国产aⅴ无密码| 成人av午夜电影|