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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? readme.cv

?? pthread source code,you can compile directly
?? CV
?? 第 1 頁 / 共 5 頁
字號:
}...David Schwartz <davids@webmaster.com> wrote:>> > It's compliant>>>> That is really good.>>> Tomorrow (I have to go urgently now) I will try to>> demonstrate the lost-signal "problem" of current>> pthread-win32 and ACE-(variant w/o SingleObjectAndWait)>> implementations: players start suddenly drop their balls :-)>> (with no change in source code).>>Signals aren't lost, they're going to the main thread,>which isn't coded correctly to handle them. Try this:>>  // Wait for players to stop>  do {>>    pthread_cond_wait( &cndGameStateChange,&mtxGameStateLock );>printf("Main thread stole a signal\n");>>  } while ( eGameState < BOTH_PLAYERS_GONE );>>I bet everytime you thing a signal is lost, you'll see that printf.>The signal isn't lost, it was stolen by another thread.well, you can probably loose your bet.. it was indeed stolenby "another" thread but not the one you seem to think of.I think that what actually happens is the following:H:\SA\UXX\pt\PTHREADS\TESTS>tennis3.exePLAYER-APLAYER-B----PLAYER-B: SPURIOUS WAKEUP!!!PLAYER-A GONEPLAYER-B GONEGAME OVERH:\SA\UXX\pt\PTHREADS\TESTS>here you can see that PLAYER-B after playing his firstball (which came via signal from PLAYER-A) just droppedit down. What happened is that his signal to player Awas consumed as spurious wakeup by himself (player B).The implementation has a problem:================waiting threads:================{ /** Critical Section  inc cond.waiters_count}  /*  /* Atomic only if using Win32 SignalObjectAndWait  /*  cond.mtx.release  /*** ^^-- A THREAD WHICH DID SIGNAL MAY ACQUIRE THE MUTEX,  /***      GO INTO WAIT ON THE SAME CONDITION AND OVERTAKE  /***      ORIGINAL WAITER(S) CONSUMING ITS OWN SIGNAL!  cond.sem.waitPlayer-A after playing game's initial ball went intowait (called _wait) but was pre-empted before reachingwait semaphore. He was counted as waiter but was notactually waiting/blocked yet.===============signal threads:==============={ /** Critical Section  waiters_count = cond.waiters_count}  if ( waiters_count != 0 )    sem.post 1  endifPlayer-B after he received signal/ball from Player Acalled _signal. The _signal did see that there wasone waiter blocked on the condition (Player-A) andreleased the semaphore.. (but it did not unblockPlayer-A because he was not actually blocked).Player-B thread continued its execution, called _wait,was counted as second waiter BUT was allowed to slipthrough opened semaphore gate (which was opened forPlayer-B) and received his own signal. Player B remainedblocked followed by Player A. Deadlock happened whichlasted until main thread came in and said game over.It seems to me that the implementation fails tocorrectly implement the following statementfrom specification:http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_cond_wait.html"These functions atomically release mutex and causethe calling thread to block on the condition variablecond; atomically here means "atomically with respectto access by another thread to the mutex and then thecondition variable". That is, if another thread isable to acquire the mutex after the about-to-blockthread has released it, then a subsequent call topthread_cond_signal() or pthread_cond_broadcast()in that thread behaves as if it were issued afterthe about-to-block thread has blocked."Question: Am I right?(I produced the program output above by simplyadding ?Sleep( 1 )?:================waiting threads:================{ /** Critical Section  inc cond.waiters_count}  /*  /* Atomic only if using Win32 SignalObjectAndWait  /*  cond.mtx.releaseSleep( 1 ); // Win32  /*** ^^-- A THREAD WHICH DID SIGNAL MAY ACQUIRE THE MUTEX,  /***      GO INTO WAIT ON THE SAME CONDITION AND OVERTAKE  /***      ORIGINAL WAITER(S) CONSUMING ITS OWN SIGNAL!  cond.sem.waitto the source code of pthread-win32 implementation:http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/condvar.c?rev=1.36&content-type=text/x-cvsweb-markup&cvsroot=pthreads-win32  /*  * We keep the lock held just long enough to increment the count of  * waiters by one (above).  * Note that we can't keep it held across the  * call to sem_wait since that will deadlock other calls  * to pthread_cond_signal  */  cleanup_args.mutexPtr = mutex;  cleanup_args.cv = cv;  cleanup_args.resultPtr = &result;  pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *)&cleanup_args);  if ((result = pthread_mutex_unlock (mutex)) == 0)    {((resultSleep( 1 ); // @AT      /*      * Wait to be awakened by      *              pthread_cond_signal, or      *              pthread_cond_broadcast, or      *              a timeout      *      * Note:      *      ptw32_sem_timedwait is a cancelation point,      *      hence providing the      *      mechanism for making pthread_cond_wait a cancelation      *      point. We use the cleanup mechanism to ensure we      *      re-lock the mutex and decrement the waiters count      *      if we are canceled.      */      if (ptw32_sem_timedwait (&(cv->sema), abstime) == -1)         {          result = errno;        }    }  pthread_cleanup_pop (1);  /* Always cleanup */BTW, on my system (2 CPUs) I can manage to getsignals lost even without any source code modificationif I run the tennis program many times in differentshell sessions....David Schwartz <davids@webmaster.com> wrote:>terekhov@my-deja.com wrote:>>> well, it might be that the program is in fact buggy.>> but you did not show me any bug.>>You're right. I was close but not dead on. I was correct, however,>that the code is buggy because it uses 'pthread_cond_signal' even>though not any thread waiting on the condition variable can do the>job. I was wrong in which thread could be waiting on the cv but>unable to do the job.Okay, lets change 'pthread_cond_signal' to 'pthread_cond_broadcast'but also add some noise from main() right before declaring the gameto be over (I need it in order to demonstrate another problem ofpthread-win32/ACE implementations - broadcast deadlock)......It is my understanding of POSIX conditions,that on correct implementation added noisein form of unnecessary broadcasts from main,should not break the tennis program. Theonly 'side effect' of added noise on correctimplementation would be 'spurious wakeups' ofplayers (in fact they are not spurious,players just see them as spurious) unblocked,not by another player but by main beforeanother player had a chance to acquire themutex and change the game state variable:...PLAYER-BPLAYER-A---Noise ON...PLAYER-BPLAYER-A...PLAYER-BPLAYER-A----PLAYER-A: SPURIOUS WAKEUP!!!PLAYER-BPLAYER-A---Noise OFFPLAYER-B---Stopping the game...PLAYER-A GONEPLAYER-B GONEGAME OVERH:\SA\UXX\pt\PTHREADS\TESTS>On pthread-win32/ACE implementations theprogram could stall:...PLAYER-APLAYER-BPLAYER-APLAYER-BPLAYER-APLAYER-BPLAYER-APLAYER-B---Noise ON...PLAYER-A---Noise OFF^CH:\SA\UXX\pt\PTHREADS\TESTS>The implementation has problems:================waiting threads:================{ /** Critical Section  inc cond.waiters_count}  /*  /* Atomic only if using Win32 SignalObjectAndWait  /*  cond.mtx.release  cond.sem.wait  /*** ^^-- WAITER CAN BE PREEMPTED AFTER BEING UNBLOCKED...{ /** Critical Section  dec cond.waiters_count  /*** ^^- ...AND BEFORE DECREMENTING THE COUNT (1)  last_waiter = ( cond.was_broadcast &&                    cond.waiters_count == 0 )  if ( last_waiter )    cond.was_broadcast = FALSE  endif}  if ( last_waiter )    /*    /* Atomic only if using Win32 SignalObjectAndWait    /*    cond.auto_reset_event_or_sem.post /* Event for Win32    cond.mtx.acquire  /*** ^^-- ...AND BEFORE CALL TO mtx.acquire (2)  /*** ^^-- NESTED BROADCASTS RESULT IN A DEADLOCK  else    cond.mtx.acquire  /*** ^^-- ...AND BEFORE CALL TO mtx.acquire (3)  endif==================broadcast threads:=================={ /** Critical Section  waiters_count = cond.waiters_count  if ( waiters_count != 0 )    cond.was_broadcast = TRUE  endif}if ( waiters_count != 0 )  cond.sem.post waiters_count  /*** ^^^^^--- SPURIOUS WAKEUPS DUE TO (1)  cond.auto_reset_event_or_sem.wait /* Event for Win32  /*** ^^^^^--- DEADLOCK FOR FURTHER BROADCASTS IF THEY                HAPPEN TO GO INTO WAIT WHILE PREVIOUS                BROADCAST IS STILL IN PROGRESS/WAITINGendifa) cond.waiters_count does not accurately reflectnumber of waiters blocked on semaphore - that couldresult (in the time window when counter is not accurate)in spurios wakeups organised by subsequent _signalsand _broadcasts. From standard compliance point of viewthat is OK but that could be a real problem fromperformance/efficiency point of view.b) If subsequent broadcast happen to go into wait oncond.auto_reset_event_or_sem before previousbroadcast was unblocked from cond.auto_reset_event_or_semby its last waiter, one of two blocked threads willremain blocked because last_waiter processing codefails to unblock both threads.In the situation with tennisb.c the Player-B was putin a deadlock by noise (broadcast) coming from mainthread. And since Player-B holds the game statemutex when it calls broadcast, the whole programstalled: Player-A was deadlocked on mutex andmain thread after finishing with producing the noisewas deadlocked on mutex too (needed to declare thegame over)(I produced the program output above by simplyadding ?Sleep( 1 )?:==================broadcast threads:=================={ /** Critical Section  waiters_count = cond.waiters_count  if ( waiters_count != 0 )    cond.was_broadcast = TRUE  endif}if ( waiters_count != 0 )Sleep( 1 ); //Win32  cond.sem.post waiters_count  /*** ^^^^^--- SPURIOUS WAKEUPS DUE TO (1)  cond.auto_reset_event_or_sem.wait /* Event for Win32  /*** ^^^^^--- DEADLOCK FOR FURTHER BROADCASTS IF THEY                HAPPEN TO GO INTO WAIT WHILE PREVIOUS                BROADCAST IS STILL IN PROGRESS/WAITINGendifto the source code of pthread-win32 implementation:http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/condvar.c?rev=1.36&content-type=text/x-cvsweb-markup&cvsroot=pthreads-win32  if (wereWaiters)    {(wereWaiters)sroot=pthreads-win32eb.cgi/pthreads/Yem...m      /*      * Wake up all waiters      */Sleep( 1 ); //@AT#ifdef NEED_SEM      result = (ptw32_increase_semaphore( &cv->sema, cv->waiters )                 ? 0                : EINVAL);#else /* NEED_SEM */      result = (ReleaseSemaphore( cv->sema, cv->waiters, NULL )                 ? 0                : EINVAL);#endif /* NEED_SEM */    }  (void) pthread_mutex_unlock(&(cv->waitersLock));  if (wereWaiters && result == 0)    {(wereWaiters

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产三级国产aⅴ中文| 日本一二三不卡| 国产精品66部| 亚洲一区二区精品视频| 久久免费看少妇高潮| 91国偷自产一区二区三区成为亚洲经典| 五月激情综合婷婷| 综合久久一区二区三区| 日韩欧美自拍偷拍| 91美女片黄在线| 美国毛片一区二区| 洋洋av久久久久久久一区| 久久精品视频在线看| 欧美午夜精品久久久久久孕妇| 粉嫩av一区二区三区| 蜜臀av一级做a爰片久久| 亚洲裸体xxx| 亚洲国产精品成人综合| 欧美不卡一二三| 欧美日韩综合一区| 97久久久精品综合88久久| 国产乱子轮精品视频| 日本 国产 欧美色综合| 一区二区三区四区中文字幕| 久久精品视频在线看| 日韩精品一区二区三区视频在线观看 | 日韩免费观看高清完整版| 91精彩视频在线| av电影天堂一区二区在线观看| 免费观看一级欧美片| 婷婷丁香激情综合| 亚洲国产精品天堂| 亚洲裸体在线观看| 日韩一区有码在线| 亚洲欧美日韩中文字幕一区二区三区| 久久久精品黄色| 精品久久免费看| 日韩视频在线永久播放| 欧美日本韩国一区二区三区视频| 在线视频你懂得一区| 99久久精品国产毛片| 99在线精品视频| 成人精品免费看| 粉嫩在线一区二区三区视频| 国产精品系列在线观看| 国产一区二区不卡在线| 国产一区二区三区不卡在线观看 | 免费看日韩精品| 亚洲高清视频中文字幕| 亚洲香蕉伊在人在线观| 亚洲国产三级在线| 亚洲国产综合色| 亚洲成av人片在线| 日韩专区一卡二卡| 日本成人在线看| 久久成人免费日本黄色| 韩国欧美国产1区| 国产白丝网站精品污在线入口| 国产成人免费视频一区| zzijzzij亚洲日本少妇熟睡| 91在线无精精品入口| 91高清视频在线| 91麻豆精品国产自产在线| 日韩美女主播在线视频一区二区三区| 精品理论电影在线观看| 欧美激情一区二区三区四区| 综合久久久久综合| 亚洲第一狼人社区| 久久9热精品视频| 成人永久看片免费视频天堂| 91女人视频在线观看| 欧美日韩亚洲高清一区二区| 日韩天堂在线观看| 欧美国产1区2区| 亚洲一级在线观看| 麻豆91小视频| av亚洲精华国产精华精华| 欧美视频中文字幕| 欧美videos中文字幕| 日本一区二区高清| 午夜日韩在线电影| 国产在线播精品第三| 97国产一区二区| 欧美一区二区三区四区久久| 国产亚洲精品福利| 亚洲香肠在线观看| 国产精品一卡二| 在线观看免费亚洲| 久久综合九色综合97婷婷| 亚洲日本在线天堂| 精品一区二区三区日韩| 色综合久久久久综合| 日韩精品一区二区三区swag| 国产日产欧美一区| 午夜精品爽啪视频| 成人激情动漫在线观看| 91精品欧美久久久久久动漫 | 激情综合色综合久久综合| av午夜精品一区二区三区| 在线不卡a资源高清| 国产精品的网站| 麻豆精品国产91久久久久久| 91视频com| 国产亚洲一区二区在线观看| 五月天一区二区三区| 不卡的av电影| 日韩女优电影在线观看| 亚洲综合999| 成人在线视频一区| 久久只精品国产| 午夜精品视频在线观看| 日本精品视频一区二区| 欧美国产在线观看| 精品午夜久久福利影院| 欧美日韩国产免费一区二区| 国产精品日韩成人| 国产精品一区一区三区| 欧美一级淫片007| 亚洲综合在线视频| 91网站在线观看视频| 国产欧美日韩三级| 国产在线精品不卡| 精品国产免费人成在线观看| 天天色天天操综合| 欧美美女视频在线观看| 亚洲欧美日韩国产一区二区三区| 国产a视频精品免费观看| 欧美电影免费观看高清完整版| 香蕉久久一区二区不卡无毒影院| 91色综合久久久久婷婷| 亚洲欧洲国产日本综合| 成人av第一页| 国产精品人妖ts系列视频| 国产精品911| 中文子幕无线码一区tr| 国产成人小视频| 国产亚洲欧洲一区高清在线观看| 久久福利视频一区二区| 欧美成va人片在线观看| 免费在线观看一区| 欧美大片在线观看一区二区| 日本系列欧美系列| 欧美一区二区三区在线视频| 日本 国产 欧美色综合| 欧美一区二区三区四区高清| 蜜臀久久99精品久久久久宅男| 69堂精品视频| 久久精品国产成人一区二区三区| 精品国产91乱码一区二区三区| 免费成人av在线播放| 精品精品国产高清a毛片牛牛 | 在线观看欧美黄色| 亚洲成人福利片| 5858s免费视频成人| 免费在线观看精品| 精品99久久久久久| 国产91丝袜在线播放| 亚洲女与黑人做爰| 欧美日韩一区二区在线观看| 偷窥少妇高潮呻吟av久久免费| 91精品国产一区二区| 精品亚洲成a人在线观看| 国产色产综合产在线视频| 99久久免费国产| 亚洲图片自拍偷拍| 日韩精品一区二区三区中文不卡 | 日韩精品一区在线观看| 国产成人一级电影| 亚洲精品老司机| 欧美日韩在线精品一区二区三区激情| 日韩高清一区在线| 中文字幕精品在线不卡| 色呦呦网站一区| 免费观看一级欧美片| 国产女人18毛片水真多成人如厕| 色婷婷久久一区二区三区麻豆| 一区二区三区**美女毛片| 91精品国产综合久久精品app| 国产一区二区三区精品视频| 亚洲欧美激情插| 日韩精品一区二区三区在线观看| 成人h动漫精品一区二| 日韩国产在线一| 日本一区二区久久| 91精品婷婷国产综合久久性色| 国产精选一区二区三区 | 国产一区二区三区四区五区入口| 中文字幕国产精品一区二区| 欧美精品xxxxbbbb| 国产成人精品网址| 日韩精品成人一区二区三区| 国产视频一区不卡| 日韩一区二区在线看| av不卡在线观看| 精品亚洲aⅴ乱码一区二区三区| 一区二区在线观看av| 久久只精品国产| 欧美精品一二三四| 91免费观看在线| 国产一区二区三区免费播放|