锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久国产综合精品,国产精品久久久久毛片大屁完整版,欧美视频在线播放http://m.shnenglu.com/izualzhy/archive/2011/11/14/160123.htmlizualzhyizualzhyMon, 14 Nov 2011 14:47:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160123.htmlhttp://m.shnenglu.com/izualzhy/comments/160123.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160123.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160123.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160123.htmlpthread澶氱嚎紼嬪涔犵瑪璁板叚綰跨▼灞炴х瘒

鍏跺疄綰跨▼灞炴ф垜鐪嬫槑鐧界殑寰堝皯錛屽洜涓哄睘鎬у緢澶氾紝寰堝閮芥案涓嶅埌錛屽緢澶氳櫧鐒剁湅浜嗗嵈娌℃硶璇曢獙涓嬶紝鍥犳涓嶇煡閬撳閿欍傛劅瑙夊叧浜庡綰跨▼鏈夊彞璇濊鐨勫緢瀵癸紝鏈夊緢澶氬綰跨▼鐨勭▼搴忥紝鍙湁鍦ㄥ涓満鍣紝澶氫釜緋葷粺涓婇兘璇曢獙榪囷紝鎵嶇煡閬撳涓嶅錛岄敊鍦ㄥ摢閲屻?

鍦?usr/include/pthread.h閲屽彲浠ョ湅鍒頒竴鍫嗗叧浜巗et or get attr鐨勫嚱鏁幫紝澶ф鍏ㄦ槸榪欎釜鏍峰瓙鐨勶細pthread_attr_set*() 鎴栬卲thread_attr_get*();

鎯充簡涓嬶紝鍏堜粠涓涓櫘閫氫緥瀛愬紑濮嬭璧鳳細

#include <stdio.h>

#include <unistd.h>

int main()

{

const size_t asize = (8192*1024+1024*1024*2)/sizeof(int);

/*const size_t asize = 8388608/sizeof(int);*/

printf("heap:\n");

int *parray;

parray = malloc(asize*sizeof(int));

parray[asize-1] = 1;

printf("stack:\n");

int array[asize];

printf("%u\n",asize);

array[asize-1]=1;

return 0;

}


紼嬪簭杈撳嚭錛?

heap:

stack:

孌甸敊璇?

涓轟粈涔堜細榪欐牱?鍥犱負姣忎釜榪涚▼鐨勬爤澶у皬鏄湁闄愬埗鐨勶紝渚嬪鎴戠殑錛?

$ ulimit -a

core file size (blocks, -c) 0

data seg size (kbytes, -d) unlimited

scheduling priority (-e) 20

file size (blocks, -f) unlimited

pending signals (-i) 16382

max locked memory (kbytes, -l) 64

max memory size (kbytes, -m) unlimited

open files (-n) 1024

pipe size (512 bytes, -p) 8

POSIX message queues (bytes, -q) 819200

real-time priority (-r) 0

stack size (kbytes, -s) 8192

cpu time (seconds, -t) unlimited

max user processes (-u) unlimited

virtual memory (kbytes, -v) unlimited

file locks (-x) unlimited

閫氳繃ulimit 鈥搒鍙互淇敼榪涚▼鏍堢殑澶у皬浣胯繖涓▼搴忚繍琛孫K錛堜篃鍙兘涓嶈錛岃窡紜歡鏈夊叧錛夈?

鎴戜滑榪欓噷鏁扮粍澶у皬涓嶆鐢ㄥ埌浜?192k錛屽洜涓簂inux涓嬭繕鏈変竴涓爤鐨勭紦鍐插尯銆?

瀹為檯涓婅繘紼嬪湪榪愯鏃跺茍涓嶄竴瀹氫細鐢ㄥ埌8192k澶у皬鐨勬爤錛岃繖鏄竴涓渶澶у鹼紝鍙互鍐欎袱涓嬌鐢ㄤ笉鍚屾爤澶у皬鐨勪緥瀛愶紝pause鍚庯紝鏌ョ湅/proc/*/maps璇曢獙涓嬨?

浣嗙嚎紼嬫槸涓嶅悓鐨勶紝綰跨▼鐨勬爤鍙互閫氳繃鏆撮湶鏍堟寚閽堢殑鏂瑰紡鍏變韓銆傛棤璁虹嚎紼嬩嬌鐢ㄥ灝忕殑鏍堬紝榪涚▼閮戒細鍒嗛厤涓瀹氭暟鐩紙鎴戠殑鏄?M錛屽彲浠ラ氳繃綰跨▼灞炴у嚱鏁版潵鏌ョ湅錛夊ぇ灝忕殑鏍堢粰綰跨▼浣跨敤銆傚鏋滅嚎紼嬩笉鏄互detach緇撴潫鐨勶紝閭d箞鍙湁鐢╦oin鍑芥暟鑾峰緱綰跨▼閫鍑虹姸鎬佸悗鎵嶈兘鍥炴敹璇ョ嚎紼嬭祫婧愶紝榪欏氨鏄渶寮濮嬫垜浠鍒癹oin鍑芥暟鐨勪綔鐢ㄣ?

鐢ㄤ竴涓緥瀛愭祴璇曚笅綰跨▼鏁扮洰錛?/p>

#include <stdio.h>

#include <string.h>

#include <pthread.h>

void *test(void *arg)

{

/*pthread_detach(pthread_self());*/

}

int main()

{

int err;

int i = 0;

pthread_t tid;

pthread_attr_t attr;

pthread_attr_init(&attr);

pthread_attr_setstacksize(&attr,1024*1024*16);

while (1) {

err = pthread_create(&tid,NULL,test,NULL);

/*err = pthread_create(&tid,&attr,test,NULL);*/

if (err!=0) {

printf("create thread error: %s!\n",strerror(err));

exit(1);

}

++i;

printf("i=%d\n",i);

}

return 0;

}


鎴戠殑鏈哄櫒涓婄粨鏋滄槸381錛屾湁鏃?82錛屾敞鎰忔鏃惰繖閲岃繑鍥炲煎氨鏄渶寮濮嬫彁鍒扮殑EAGAIN銆傚鏋滄敞閲婃斁寮鐨勮瘽錛屽氨鍙互涓鐩磋繍琛屼笅鍘伙紝鍥犱負璧勬簮琚洖鏀躲備笉榪囩敤鏈夌殑鏈哄櫒璇曢獙鏃訛紝鏁伴噺铏界劧澧炲ぇ浜嗭紝浣嗗茍涓嶈兘涓鐩磋繍琛屼笅鍘匯傛病鎯蟲竻妤氫粈涔堝師鍥犮?

紼嬪簭閲屾湁鍑犱釜鍏充簬灞炴х殑鍑芥暟錛屼笉榪囨殏鏃舵病鏈夌敤鍒幫紝鍏充簬鍑芥暟鐨勪綔鐢紝鍦╬thread.h閲屽彲浠ョ洿鎺ョ湅鍒般?

浠庣綉涓婃悳鍒扮殑鍏充簬綰跨▼鏈澶ф暟鐩殑瑙i噴錛?

榪欎釜鍊煎拰鐞嗚瀹屽叏鐩哥錛屽洜涓?32 浣?linux 涓嬬殑榪涚▼鐢ㄦ埛絀洪棿鏄?3G 鐨勫ぇ灝忥紝涔熷氨鏄?3072M錛岀敤 3072M 闄や互 8M 寰?384錛屼絾鏄疄闄呬笂浠g爜孌靛拰鏁版嵁孌電瓑榪樿鍗犵敤涓浜涚┖闂達紝榪欎釜鍊煎簲璇ュ悜涓嬪彇鏁村埌 383錛屽啀鍑忓幓涓葷嚎紼嬶紝寰楀埌 382銆?

閭d負浠涔?linuxthreads 涓婅繕瑕佸皯涓涓嚎紼嬪憿錛熻繖鍙お瀵逛簡錛屽洜涓?linuxthreads 榪橀渶瑕佷竴涓鐞嗙嚎紼?

涓轟簡紿佺牬鍐呭瓨鐨勯檺鍒訛紝鍙互鏈変袱縐嶆柟娉?

1) 鐢?ulimit -s 1024 鍑忓皬榛樿鐨勬爤澶у皬

2) 璋冪敤 pthread_create 鐨勬椂鍊欑敤 pthread_attr_getstacksize 璁劇疆涓涓緝?yōu)畯鐨勬爤澶?

瑕佹敞鎰忕殑鏄紝鍗充嬌榪欐牱鐨勪篃鏃犳硶紿佺牬 1024 涓嚎紼嬬殑紜檺鍒訛紝闄ら潪閲嶆柊緙栬瘧 C 搴撱?

铏界劧緇撴灉涓嶆槸紜畾鐨勶紝涓嶈繃榪欎釜瑙i噴鎰熻涔熻繕鏄緢鍚堢悊鐨勩?

鍙互閫氳繃紼嬪簭閲岀嚎紼嬬殑attr錛堝嵆鍦╟reate鐨勬椂鍊欎笉閲囩敤NULL鑰岄噰鐢ㄨ繖涓猘ttr錛夊緩绔嬬嚎紼嬭瀵熶笅綰跨▼鏈澶ф暟鐩啀璁$畻涓嬮獙璇佷笅緇撴灉銆?

鍏充簬鏈寮濮嬮偅涓▼搴忕殑孌甸敊璇紝鍦ㄧ嚎紼嬮噷涓鏍蜂細鏈夛紝鐩稿簲鐨勯氳繃pthread_attr_setstacksize(&attr,stackSize)灝卞彲浠ヨВ鍐充簡銆?

鍏充簬灞炴э紝寰堝涓鐭ュ崐瑙g殑錛屽氨涓嶆嬁涓婃潵璐葷瑧澶ф柟浜嗐?

鍏充簬pthread澶氱嚎紼嬬紪紼嬶紝鐢ㄧ殑澶氱殑璇濓紝鍏跺疄闇瑕佸涔犵殑鍦版柟榪樻湁寰堝錛屾劅瑙夎繖浜涜兘澶熸弧瓚充竴浜涘熀鏈殑浣跨敤浜嗭紝鍏朵粬鐨勬瘮濡備俊鍙烽噺絳夛紝絳夊啀鏈変嬌鐢ㄤ笂鐨勫績寰楃殑鏃跺欏啀涓婃潵鎬葷粨浜嗐?

izualzhy 2011-11-14 22:47 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺4浣跨敤涔媠ignal鍙兘鍞ら啋褰撳墠澶勪簬wait鐨勭嚎紼?/title><link>http://m.shnenglu.com/izualzhy/archive/2011/11/14/160122.html</link><dc:creator>izualzhy</dc:creator><author>izualzhy</author><pubDate>Mon, 14 Nov 2011 14:45:00 GMT</pubDate><guid>http://m.shnenglu.com/izualzhy/archive/2011/11/14/160122.html</guid><wfw:comment>http://m.shnenglu.com/izualzhy/comments/160122.html</wfw:comment><comments>http://m.shnenglu.com/izualzhy/archive/2011/11/14/160122.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/izualzhy/comments/commentRss/160122.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/izualzhy/services/trackbacks/160122.html</trackback:ping><description><![CDATA[<p>pthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺4浣跨敤涔媠ignal鍙兘鍞ら啋褰撳墠澶勪簬wait鐨勭嚎紼?<p><strong>鐩村涓婚錛屽鏋渟ignal鐨勬椂鍊欐病鏈夌嚎紼嬪湪鏉′歡絳夊緟闃熷垪閲岋紝閭d箞鏈signal灝辨病鏈夋晥鏋滐紝鍚庣畫鐨勭嚎紼嬭繘鍏ユ潯浠墮槦鍒椾箣鍚庯紝鏃犳硶琚箣鍓嶇殑signal鍞ら啋銆?/strong> <p>浼間箮榪欎笌Windows涓婁笉涓鏍鳳紵 <p>鑰冭檻涓涓儏褰紝鏃呭鍦ㄥ嚭縐熻濺鐐規(guī)帓闃燂紙榪涘叆wait闃熷垪錛夛紝褰撴湁鍑虹杞﹀埌鏉ユ椂錛岄福絎涙垨鑰呭共鍟ョ殑錛堟諱箣灝辨槸signal錛夛紝鏃呭涓婅濺銆?<p>浜庢槸鏈変簡涓嬮潰榪欎釜渚嬪瓙錛?/p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #cc6633">#include</span> <stdio.h><br><br><span style="color: #cc6633">#include</span> <pthread.h><br><br>pthread_cond_t taxiCond;<br><br>pthread_mutex_t taxiMutex;<br><br><span style="color: #0000ff">void</span> *travelerArrive(<span style="color: #0000ff">void</span> *name)<br><br>{<br><br>printf(<span style="color: #006080">"Traveler: %s need a taxi now!\n"</span>,(<span style="color: #0000ff">char</span>*)name);<br><br>pthread_mutex_lock(&taxiMutex);<br><br>pthread_cond_wait(&taxiCond, &taxiMutex);<br><br>pthread_mutex_unlock(&taxiMutex);<br><br>printf(<span style="color: #006080">"Traveler: %s now got a taxi!\n"</span>,(<span style="color: #0000ff">char</span>*)name);<br><br>pthread_exit((<span style="color: #0000ff">void</span>*)0);<br><br>}<br><br><span style="color: #0000ff">void</span> *taxiArrive(<span style="color: #0000ff">void</span> *name)<br><br>{<br><br>printf(<span style="color: #006080">"Taxi %s arrives\n"</span>,(<span style="color: #0000ff">char</span>*)name);<br><br>pthread_cond_signal(&taxiCond);<br><br>pthread_exit((<span style="color: #0000ff">void</span>*)0);<br><br>}<br><br><span style="color: #0000ff">int</span> main()<br><br>{<br><br>pthread_t thread;<br><br>pthread_attr_t threadAttr;<br><br>pthread_attr_init(&threadAttr);<br><br>pthread_cond_init(&taxiCond,NULL);<br><br><span style="color: #008000">/*pthread_create(&thread, &threadAttr, travelerArrive, (void*)("Liona"));*/</span><br><br><span style="color: #008000">/*sleep(1);*/</span><br><br>pthread_create(&thread, &threadAttr, taxiArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Jack"</span>));<br><br>sleep(1);<br><br>pthread_create(&thread, &threadAttr, travelerArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Susan"</span>));<br><br>sleep(1);<br><br>pthread_create(&thread, &threadAttr, taxiArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Mike"</span>));<br><br>sleep(1);<br><br><span style="color: #0000ff">return</span> 0;<br><br>}<br></pre><br></div> <p>褰揓ack鍑虹杞﹀埌杈懼悗錛宻ignal錛屽疄闄呬笂娌℃湁鏁堟灉銆? <p>褰揝usan鍒頒簡鍚庯紝榪涘叆wait闃熷垪錛屾槸鏀朵笉鍒板摝鍟奐ack鐨剆ignal鐨勩? <p>鍙湁褰揗ike鍑虹杞﹀埌浜嗗悗錛宻ignal錛孲usan鏀跺埌銆? <p>紼嬪簭杈撳嚭錛? <p>Taxi Jack arrives <p>Traveler: Susan need a taxi now! <p>Taxi Mike arrives <p>Traveler: Susan now got a taxi! <p>濡傛灉瑙夊緱榪欐牱涓嶅悎鐞嗭紝鍏跺疄瀹規(guī)槗鏀瑰彉錛屽姞涓涓叧浜庢梾瀹漢鏁扮殑鍏ㄥ眬鍙橀噺鍗沖彲錛屼慨鏀瑰悗鐨勭▼搴忓涓嬶細</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #cc6633">#include</span> <stdio.h><br><br><span style="color: #cc6633">#include</span> <pthread.h><br><br>pthread_cond_t taxiCond;<br><br>pthread_mutex_t taxiMutex;<br><br><span style="color: #0000ff">int</span> travelerCount = 0;<br><br><span style="color: #0000ff">void</span> *travelerArrive(<span style="color: #0000ff">void</span> *name)<br><br>{<br><br>printf(<span style="color: #006080">"Traveler: %s need a taxi now!\n"</span>,(<span style="color: #0000ff">char</span>*)name);<br><br>pthread_mutex_lock(&taxiMutex);<br><br>travelerCount++;<br><br>pthread_cond_wait(&taxiCond, &taxiMutex);<br><br>travelerCount--;<br><br>pthread_mutex_unlock(&taxiMutex);<br><br>printf(<span style="color: #006080">"Traveler: %s now got a taxi!\n"</span>,(<span style="color: #0000ff">char</span>*)name);<br><br>pthread_exit((<span style="color: #0000ff">void</span>*)0);<br><br>}<br><br><span style="color: #0000ff">void</span> *taxiArrive(<span style="color: #0000ff">void</span> *name)<br><br>{<br><br>printf(<span style="color: #006080">"Taxi %s arrives\n"</span>,(<span style="color: #0000ff">char</span>*)name);<br><br><span style="color: #0000ff">while</span> (1) {<br><br>pthread_mutex_lock(&taxiMutex);<br><br><span style="color: #0000ff">if</span> (travelerCount>0) {<br><br>pthread_cond_signal(&taxiCond);<br><br>pthread_mutex_unlock(&taxiMutex);<br><br><span style="color: #0000ff">break</span>;<br><br>}<br><br>pthread_mutex_unlock(&taxiMutex);<br><br>}<br><br>pthread_exit((<span style="color: #0000ff">void</span>*)0);<br><br>}<br><br><span style="color: #0000ff">int</span> main()<br><br>{<br><br>pthread_t thread;<br><br>pthread_attr_t threadAttr;<br><br>pthread_attr_init(&threadAttr);<br><br>pthread_cond_init(&taxiCond,NULL);<br><br><span style="color: #008000">/*pthread_create(&thread, &threadAttr, travelerArrive, (void*)("Liona"));*/</span><br><br><span style="color: #008000">/*sleep(1);*/</span><br><br>pthread_create(&thread, &threadAttr, taxiArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Jack"</span>));<br><br>sleep(1);<br><br>pthread_create(&thread, &threadAttr, taxiArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Join"</span>));<br><br>sleep(1);<br><br>pthread_create(&thread, &threadAttr, travelerArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Susan"</span>));<br><br>sleep(1);<br><br>pthread_create(&thread, &threadAttr, taxiArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Mike"</span>));<br><br>sleep(1);<br><br>pthread_create(&thread, &threadAttr, travelerArrive, (<span style="color: #0000ff">void</span>*)(<span style="color: #006080">"Lyn"</span>));<br><br>sleep(1);<br><br><span style="color: #0000ff">return</span> 0;<br><br>}<br></pre><br></div><img src ="http://m.shnenglu.com/izualzhy/aggbug/160122.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/izualzhy/" target="_blank">izualzhy</a> 2011-11-14 22:45 <a href="http://m.shnenglu.com/izualzhy/archive/2011/11/14/160122.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺3浣跨敤涔嬪綋wait閬囧埌pthread_cancelhttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160121.htmlizualzhyizualzhyMon, 14 Nov 2011 14:44:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160121.htmlhttp://m.shnenglu.com/izualzhy/comments/160121.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160121.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160121.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160121.htmlpthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺3浣跨敤涔嬪綋wait閬囧埌pthread_cancel

pthread_cond_wait,pthread_cond_timewait鏄瀹炵幇涓哄彇娑堢偣鐨勶紝鍙栨秷鐐圭殑鍚箟鏄鏋滆綰跨▼鏄彲鍙栨秷鐨勶紝閭d箞褰撳埌杈懼彇娑堢偣鐨勬椂鍊欙紝璇ョ嚎紼嬩細鍙栨秷鎺夊茍榪斿洖銆?/strong>

鍏堢湅涓涓緥瀛愶細

#include <stdio.h>

#include <pthread.h>

#include <unistd.h>

pthread_mutex_t mutex;

pthread_cond_t cond;

void *child1(void *arg)

{

/*pthread_cleanup_push(pthread_mutex_unlock, &mutex);*/

while (1) {

printf("thread 1 get running\n");

printf("thread 1 pthread_mutex_lock returns %d\n",pthread_mutex_lock(&mutex));

pthread_cond_wait(&cond,&mutex);

printf("thread 1 conditional applied\n");

pthread_mutex_unlock(&mutex);

sleep(5);

}

/*pthread_cleanup_pop(0);//comment 2*/

}

void *child2(void *arg)

{

while (1) {

sleep(3); //comment 3

printf("thread 2 get running.\n");

printf("thread 2 pthread_mutex_lock returns %d\n",pthread_mutex_lock(&mutex));

pthread_cond_wait(&cond,&mutex);

printf("thread 2 conditional applied\n");

pthread_mutex_unlock(&mutex);

sleep(1);

}

}

int main(void)

{

int tid1,tid2;

printf("conditional variable test\n");

pthread_mutex_init(&mutex,NULL);

pthread_cond_init(&cond,NULL);

pthread_create(&tid1, NULL, child1, NULL);

pthread_create(&tid2, NULL, child2, NULL);

do {

sleep(2);//comment 4

pthread_cancel(tid1);//comment 5

sleep(2);//comment 6

pthread_cond_signal(&cond);

}while(1);

sleep(100);

pthread_exit(0);

}

濡傛灉娉ㄩ噴鎺夌殑閮ㄥ垎涓嶆斁寮鐨勮瘽錛岀嚎紼?浼氫竴鐩村仠鍦ㄩ偅閲岋紝鍗充嬌涓葷嚎紼嬩笉鏂殑鍘籹ignal銆?

鍘熷洜鏄細

脽 pthread_cond_wait ()鍜宲thread_cond_timedwait()閮借瀹炵幇涓哄彇娑堢偣錛屽洜姝わ紝鍦ㄨ澶勭瓑寰呯殑綰跨▼灝嗙珛鍗抽噸鏂拌繍琛岋紝鍦ㄩ噸鏂伴攣瀹歮utex鍚庣寮 pthread_cond_wait()錛岀劧鍚庢墽琛屽彇娑堝姩浣溿備篃灝辨槸璇村鏋減thread_cond_wait()琚彇娑堬紝mutex鏄繚鎸侀攣瀹氱姸鎬佺殑錛屽洜鑰岄渶瑕佸畾涔夐鍑哄洖璋冨嚱鏁版潵涓哄叾瑙i攣銆?

濂戒簡錛屽叾瀹炶璇存槑鐨勫氨鏄笂闈㈣繖鍙ヨ瘽銆?

izualzhy 2011-11-14 22:44 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺2浣跨敤http://m.shnenglu.com/izualzhy/archive/2011/11/14/160120.htmlizualzhyizualzhyMon, 14 Nov 2011 14:41:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160120.htmlhttp://m.shnenglu.com/izualzhy/comments/160120.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160120.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160120.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160120.htmlpthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺2浣跨敤

涓婄瘒絎旇鐨勪緥瀛愯繍琛屾晥鏋滄病鏈夐棶棰橈紝浣嗘湁浜涚枒闂繕娌℃悶娓呮銆?

wait鍑芥暟騫朵笉鏄崟浣胯綰跨▼榪涘叆浼戠湢銆?/strong>

脽 wait鍑芥暟鍋氫互涓嬩笁姝ョ殑鎿嶄綔錛?

脽 1.閲婃斁Mutex 2.闃誨絳夊緟錛堜笉鑰楄垂cpu鍛ㄦ湡錛?3.褰撹鍞ら啋鏃訛紝閲嶆柊閿佸畾浜掓枼閿佸茍閲嶆柊嫻嬭瘯鏉′歡鏄惁婊¤凍 銆?

脽 闇瑕侀噸鏂版祴璇曟潯浠剁殑鍘熷洜鏄洜涓哄彲鑳藉瓨鍦ㄥ涓猚onsumer鐨勬儏鍐碉紝鍗沖鏋滅嚎紼嬩笉姝袱涓屾槸澶氫釜錛屽嵆浣跨嚎紼嬭鍞ら啋浜嗭紝濡傛灉涓涓猚onsumer鍙栬蛋浜嗗垪琛ㄩ噷鐨勪駭鍝侊紝閭d箞鍙﹀涓涓猚onsumer闇瑕侀噸鏂拌繘鍏ヤ紤鐪犵瓑寰呫傝繖涔熸槸涓轟粈涔堢敤while涓嶇敤if鍘誨垽鏂殑鍘熷洜銆傛潯浠跺彉閲忓彧鏄搗闃誨鍜屽敜閱掔嚎紼嬬殑浣滅敤錛屽叿浣撶殑鍒ゆ柇鏉′歡榪橀渶鐢ㄦ埛緇欏嚭銆備粠wait鎴栬卼imewait璋冪敤鎴愬姛榪斿洖鏃訛紝綰跨▼闇瑕侀噸鏂拌綆楁潯浠訛紝鍥犱負鍏朵粬鐨勭嚎紼嬪彲鑳藉凡緇忓湪榪愯騫舵敼鍙樹簡鏉′歡銆?

wait鍑芥暟浼氬湪 浼戠湢絳夊緟涔嬪墠閲婃斁閿侊紝鍥犳producer鏄笉鐢ㄦ媴蹇冧竴鐩磋幏鍙栦笉鍒伴攣鐨勩?

浼犻掔粰wait鐨勪簰鏂ラ噺瀵規(guī)潯浠惰繘琛屼繚鎶わ紝璋冪敤鑰呮妸閿佷綇鐨勪簰鏂ラ噺浼犵粰鍑芥暟銆傚嚱鏁版妸璋冪敤綰跨▼鏀懼埌絳夊緟鏉′歡鐨勭嚎紼嬪垪琛ㄤ笂錛岀劧鍚庡浜掓枼閲忚В閿侊紝榪欎袱涓搷浣滄槸鍘熷瓙鎿嶄綔銆傝繖鏍峰氨鍏抽棴浜嗘潯浠舵鏌ュ拰綰跨▼榪涘叆浼戠湢鐘舵佺瓑寰呮潯浠舵敼鍙樿繖涓や釜鎿嶄綔涔嬮棿鐨勬椂闂撮氶亾錛岃繖鏍風嚎紼嬪氨涓嶄細閿欒繃鏉′歡鐨勪換浣曞彉鍖栥傝繖灝辨槸浜掓枼閲忓拰鏉′歡涓璧蜂嬌鐢ㄧ殑鍘熷洜錛屽鏋渃onsumer鍒ゆ柇鍒板垪琛ㄤ負絀猴紝姝e噯澶囪繘鍏ヤ紤鐪狅紝鑰屾鏃秔roducer浜х敓鑺傜偣鏀懼埌浜嗗垪琛ㄩ噷錛宑onsumer鍗存帴鐫榪涘叆浼戠湢寰堟槑鏄句笉鏄垜浠兂瑕佺殑錛屽鏋減roducer鍦ㄥ叾浼戠湢鍓嶅彂鍑轟簡淇″彿錛屽張浼氶犳垚娌℃湁鎺ュ彈鑰呯殑鎯呭艦錛堜竴浼氫細璁插埌榪欎釜錛夈倃ait榪斿洖鏃訛紝浜掓枼閲忓啀嬈¤閿佷綇銆?

瑕佹敞鎰忥紝涓瀹氳鍦ㄦ敼鍙樻潯浠朵箣鍚庡啀緇欑嚎紼嬪彂淇″彿銆傚惁鍒欐棤鎰忎箟鐨勫敜閱掍紤鐪犵嚎紼嬪氨榪濆弽鎴戜滑鏈鍒濆紩鍏ユ潯浠跺彉閲忕殑鐩殑浜?

鍏充簬signal涓巑utex鐨勭浉瀵逛綅緗?/b>錛屻奤NIX楂樼駭鐜緙栫▼銆嬮噷鏄閮藉彲浠ョ殑錛屽彧瑕佸湪cond_signal涔嬪悗鑳戒粠鍒楄〃閲屽彇鍑鴻妭鐐廣傚洜涓烘槸while寰幆媯鏌ユ潯浠訛紝鎵浠ヤ笉浼氬瓨鍦ㄩ棶棰橈細綰跨▼閱掓潵錛屽彂鐜伴槦鍒椾負絀猴紝鐒跺悗榪斿洖緇х畫絳夊緟銆傚鏋滀唬鐮佷笉鑳藉蹇嶈繖縐嶇珵浜夛紝灝遍渶瑕佸湪鍚戠嚎紼嬪彂閫佷俊鍙風殑鏃跺欏崰鏈変簰鏂ラ噺銆?

鍏充簬榪欎釜錛屼粠緗戜笂鎵句簡涓嬭祫鏂欙紝涔熸槸鍚勬墽涓璇嶏紝涓昏鏄窡褰撳墠緋葷粺鐜鏈夊叧緋伙紝鍥犳騫舵棤瀹氳銆備笅闈㈢殑榪欎釜鎰熻鏄瘮杈冨悎鐞嗙殑錛?

pthread_cond_signal鍗沖彲浠ユ斁鍦╬thread_mutex_lock鍜宲thread_mutex_unlock涔嬮棿錛屼篃鍙互鏀懼湪 pthread_mutex_lock鍜宲thread_mutex_unlock涔嬪悗錛屼絾鏄悇鏈夋湁緙虹偣銆?

涔嬮棿錛?

pthread_mutex_lock

xxxxxxx

pthread_cond_signal

pthread_mutex_unlock

緙虹偣錛氬湪鏌愪笅綰跨▼鐨勫疄鐜頒腑錛屼細閫犳垚絳夊緟綰跨▼浠庡唴鏍鎬腑鍞ら啋錛堢敱浜巆ond_signal)鐒跺悗鍙堝洖鍒板唴鏍哥┖闂達紙鍥犱負cond_wait榪斿洖鍚庝細鏈夊師瀛愬姞閿佺殑 琛屼負錛夛紝鎵浠ヤ竴鏉ヤ竴鍥炰細鏈夋ц兘鐨勯棶棰樸備絾鏄湪LinuxThreads鎴栬匩PTL閲岄潰錛屽氨涓嶄細鏈夎繖涓棶棰橈紝鍥犱負鍦↙inux 綰跨▼涓紝鏈変袱涓槦鍒楋紝鍒嗗埆鏄痗ond_wait闃熷垪鍜宮utex_lock闃熷垪錛?cond_signal鍙槸璁╃嚎紼嬩粠cond_wait闃熷垪縐誨埌mutex_lock闃熷垪錛岃屼笉鐢ㄨ繑鍥炲埌鐢ㄦ埛絀洪棿錛屼笉浼氭湁鎬ц兘鐨勬崯鑰椼?

鎵浠ュ湪Linux涓帹鑽愪嬌鐢ㄨ繖縐嶆ā寮忋?

涔嬪悗錛?

pthread_mutex_lock

xxxxxxx

pthread_mutex_unlock

pthread_cond_signal

浼樼偣錛氫笉浼氬嚭鐜頒箣鍓嶈鐨勯偅涓綔鍦ㄧ殑鎬ц兘鎹熻楋紝鍥犱負鍦╯ignal涔嬪墠灝卞凡緇忛噴鏀鵑攣浜?

緙虹偣錛氬鏋渦nlock鍜宻ignal涔嬪墠錛屾湁涓綆浼樺厛綰х殑綰跨▼姝e湪mutex涓婄瓑寰呯殑璇濓紝閭d箞榪欎釜浣庝紭鍏堢駭鐨勭嚎紼嬪氨浼氭姠鍗犻珮浼樺厛綰х殑綰跨▼ 錛坈ond_wait鐨勭嚎紼?錛岃岃繖鍦ㄤ笂闈㈢殑鏀句腑闂寸殑妯″紡涓嬫槸涓嶄細鍑虹幇鐨勩?

鎵浠ワ紝鍦↙inux涓嬫渶濂絧thread_cond_signal鏀句腑闂達紝浣嗕粠緙栫▼瑙勫垯涓婅錛屽叾浠栦袱縐嶉兘鍙互銆?

鎴戠悊瑙d負signal鍚庡敜閱掔殑綰跨▼浼氬叿鏈夎緝楂樼殑鍔犻攣浼樺厛綰э紝濡傛灉鏈夊涓嚎紼嬪湪絳夊緟緇欒浜掓枼閲忓姞閿佺殑璇濓紝鍞ら啋綰跨▼浼氳幏鍙栧緱鍒伴攣錛岃岃繖鍦ㄥぇ閮ㄥ垎鎯呭喌涓嬮兘鏄垜浠墍甯屾湜鐪嬪埌鐨勩傚綋鐒跺鏂囩珷涓墍璦錛屽彲鑳戒細鏈夋ц兘鐨勯棶棰樸?

鍏充簬signal涓巄roadcast鐨勫尯鍒紝鎵懼埌涓涓В閲婂緢鏈夋剰鎬濓紙濡傛灉鎴戠殑紜湅鏄庣櫧浜嗙殑璇濓級錛?

FiLH wrote On 03/29/06 08:47,:

Hello,

I wonder what is the effective usage difference between

pthread_cond_signal and pthread_cond_broadcast.

I understand that the first awake one waiting thread, and the second

all the waiting threads (on that condition),

That is the difference.

but be seen that the

awkaed thread should enter a mutex, it seems to me in the second case

that only one thread will run while the other one will go back

waiting. But than, I see no big differences, so I must miss something,

but.. what ?

All the threads wake up, and all try to lock the

mutex. Only one at a time can succeed, and the others

must wait for a later opportunity. Yes, they "go back

waiting" -- but they are not waiting for the condition

any more, they are waiting to lock the mutex.

The bugler sounds Reveille, all the soldiers in the

barracks awaken, and they all rush for the lone shower

stall. One soldier gets there first and showers, while

the others stand around fidgeting. When the first is

done, there's a brief struggle among the others until

a second soldier hits the shower, and so on until all

the soldiers have made themselves nice and clean and

ready to go crawl in the mud all day. The soldiers who

don't happen to be first into the shower don't all go

back to bed and await another bugle call (they might

wish to, but the Drill Sergeant has other ideas).

ok銆傚彲鑳藉叧浜庝竴浜涢棶棰橈紝鏇村鐨勮繕闇瑕佸叿浣撴儏鍐靛叿浣撳垎鏋愩?/p>

izualzhy 2011-11-14 22:41 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺1浠嬬粛http://m.shnenglu.com/izualzhy/archive/2011/11/14/160119.htmlizualzhyizualzhyMon, 14 Nov 2011 14:40:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160119.htmlhttp://m.shnenglu.com/izualzhy/comments/160119.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/14/160119.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160119.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160119.htmlpthread澶氱嚎紼嬪涔犵瑪璁頒簲鏉′歡鍙橀噺1浠嬬粛

浜掓枼閲忔槸鐢ㄦ潵涓婇攣鐨勩傛湁鏃跺欐垜浠渶瑕佽繖鏍蜂竴縐嶆儏褰細

綰跨▼A闇瑕佺瓑鏌愪釜鏉′歡鎴愮珛鎵嶈兘緇х畫寰涓嬫墽琛岋紝鐜板湪榪欎釜鏉′歡涓嶆垚绔嬶紝綰跨▼A灝遍樆濉炵瓑寰咃紝鑰岀嚎紼婤鍦ㄦ墽琛岃繃紼嬩腑浣胯繖涓潯浠舵垚绔嬩簡錛屽氨鍞ら啋A緇х畫鎵ц銆?

浣跨敤浜掓枼閲忓浐鐒跺彲浠ワ紝綰跨▼A涓嶆柇鐨勫幓灝濊瘯鍔犻攣錛屼絾鍗撮犳垚cpu鍛ㄦ湡鐨勬氮璐癸紝綰跨▼A鐨勯樆濉炵瓑寰呰兘鏄笉鑰楄垂cpu鍛ㄦ湡鐨勶紵

榪欏氨鏄紩鍏ユ潯浠跺彉閲忕殑浣滅敤銆?

脽 鏉′歡鍙橀噺鏄敤鏉ョ瓑寰呰屼笉鏄敤鏉ヤ笂閿佺殑銆傛潯浠跺彉閲忕敤鏉ヨ嚜鍔ㄩ樆濉炰竴涓嚎紼嬶紝鐩村埌鏌愮壒孌婃儏鍐靛彂鐢熶負姝€傞氬父鏉′歡鍙橀噺鍜屼簰鏂ラ攣鍚屾椂浣跨敤銆?

脽 鏉′歡鍙橀噺浣挎垜浠彲浠ョ潯鐪犵瓑寰呮煇縐嶆潯浠跺嚭鐜般傛潯浠跺彉閲忔槸鍒╃敤綰跨▼闂村叡浜殑鍏ㄥ眬鍙橀噺榪涜鍚屾鐨勪竴縐嶆満鍒訛紝涓昏鍖呮嫭涓や釜鍔ㄤ綔錛氫竴涓嚎紼嬬瓑寰?鏉′歡鍙橀噺鐨勬潯浠舵垚绔?鑰屾寕璧鳳紱鍙︿竴涓嚎紼嬩嬌"鏉′歡鎴愮珛"錛堢粰鍑烘潯浠舵垚绔嬩俊鍙鳳級銆?

閽堝鏉′歡鍙橀噺鐨勮繖涓や釜鍔ㄤ綔錛屽氨瀹氫箟浜嗘潯浠跺彉閲忓搷搴旂殑涓や釜鍑芥暟銆?

絳夊緟錛?

脽 int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);

脽 int pthread_cond_timewait(pthread_cond_t *cond,pthread_mutex_t *mutex, const struct timespec *timeout)

絎簩涓嚱鏁頒粎姣旂涓涓浜嗘椂闂村彉閲忥紝濡傛灉緇欏畾鏃墮棿鍐呰繕鏈鍞ら啋錛屽垯榪斿洖ETIMEDOUT銆傛敞鎰忔椂闂存槸涓涓粷瀵瑰艱屼笉鏄竴涓浉瀵瑰鹼紝鍏蜂綋浣跨敤鍙互鍏堜嬌鐢╣ettimeofday鍑芥暟鑾峰緱鏃墮棿銆?

鍞ら啋錛?

脽 int pthread_cond_signal(pthread_cond_t *cond)

脽 int pthread_cond_broadcast(pthread_cond_t *cond)

POSIX涓轟簡綆鍖栧疄鐜幫紝鍏佽pthread_cond_signal鍦ㄥ疄鐜扮殑鏃跺欏彲浠ュ敜閱掍笉姝竴涓嚎紼?

鏉′歡鍙橀噺鐨勭被鍨嬫爣璇嗙鏄痯thread_cond_t,涓庝簰鏂ラ噺涓鏍鳳紝闇瑕佸垵濮嬪寲錛岀敤瀹屽悗闇瑕侀攢姣併?

脽 鍒濆鍖?

int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t*attr);

PTHREAD_COND_INITIALIZER

脽 閿姣侊細int pthread_cond_destroy(pthread_cond_t *cond)

鐪嬩竴涓緥瀛愶紝鏈夌偣闀匡紝鏄敓浜ц?娑堣垂鑰呮ā鍨嬬殑渚嬪瓙銆備粠涓綃囨暀紼嬮噷鎵懼埌鐨勶紝灝介噺鐨勫畬鍠勪簡涓嬶紝淇敼浜嗗叾涓彲鑳藉紩璧烽棶棰樼殑鍦版柟銆?

鐢熶駭鑰呭拰娑堣垂鑰呴兘鏄崟鐙殑涓涓嚎紼嬶紝鐢熶駭鑰呯敓浜т駭鍝侊紝娑堣垂鑰呬粠涓彇鍑轟駭鍝侊紝浜у搧鏄竴涓槦鍒楋紝鐢熶駭鑰卬ew涓涓妭鐐規(guī)坊鍔犺繘鏉ワ紝娑堣垂鑰呭彇鍑轟竴涓妭鐐瑰茍free鎺夛紝褰撴秷璐硅呭彇鐨勯熷害寰堝揩錛岃岀敓浜ц呯敓浜х殑寰堟參鏃訛紝娑堣垂鑰呭氨榪涘叆浼戠湢絳夌瓑錛坵ait錛夛紝鑰屽綋鐢熶駭鑰呯敓浜т駭鍝佸悗錛屽氨鍞ら啋錛坰ignal錛夋秷璐硅呴槦鍒椼傜▼搴忚妭鐐瑰畾涔変負涓涓粨鏋勪綋msg銆?/p>

#include <stdlib.h>

#include <pthread.h>

#include <stdio.h>

struct msg {

struct msg *next;

int num;

};

volatile struct msg *head;

pthread_cond_t hasProduct = PTHREAD_COND_INITIALIZER;

pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;

void *consumer(void *p)

{

struct msg *mp;

for(;;) {

pthread_mutex_lock(&lock);

while (head==NULL) {

/*if (head==NULL) {*/

//鏉′歡鍙椾簰鏂ラ攣淇濇姢?

//鐢╳hile涓嶇敤if?

printf("consumer entering wait......\n");

pthread_cond_wait(&hasProduct,&lock);

printf("consumer leaveing wait : %d......\n",head->num);

}

mp = head;

head = mp->next;

printf("Consume %d\n",mp->num);

pthread_mutex_unlock(&lock);

free(mp);

sleep(rand()%5);

}

}

void *producer(void *p)

{

struct msg *mp;

for(;;) {

mp = malloc(sizeof(struct msg));

mp->num = rand()%1000 + 1;

pthread_mutex_lock(&lock);

mp->next = head;

head = mp;

printf("Produce %d\n",mp->num);

pthread_mutex_unlock(&lock);

pthread_cond_signal(&hasProduct);

//signal涓巐ock浣嶇疆鏃犲叧

sleep(rand()%5);

}

}

int main(int argc, char *argv[])

{

pthread_t pid,cid;

srand(time(NULL));

pthread_create(&pid,NULL, producer, NULL);

pthread_create(&cid,NULL, consumer, NULL);

pthread_join(pid,NULL);

pthread_join(cid,NULL);

struct msg* mp = head;

while (head!=NULL) {

mp = head;

head = head->next;

printf("main thread: %d\n",mp->num);

free(mp);

}

return 0;

}

榪欎釜渚嬪瓙鏄綰跨▼緙栫▼閲屾瘮杈冪粡鍏哥殑渚嬪瓙錛屽垰寮濮嬪涔犳潯浠跺彉閲忔椂鍏跺疄寰堝闂娌″紕鏄庣櫧銆傛病鍏崇郴錛屽叾瀹炲緢澶氭潯浠跺彉閲忕殑渚嬪瓙褰㈠紡閮藉樊涓嶅鏄繖涓牱瀛愩傚叧浜庢垜鐨勭枒闂紝鍏堟彁鍑烘潵錛屼笅綃囩瑪璁伴噷涓涓竴涓褰曚笅鎵懼埌鐨勫拰鎯沖埌鐨勭瓟妗堛傘傘?

1. consumer閲屼負浠涔堟槸while鑰屼笉鏄痠f錛岃鐭ラ亾producer鏄敼鍙樹簡鏉′歡浜嗘墠signal鐨勩?/strong>

2. wait涓瀹氳鍦╨ock涔嬪悗錛屼負浠涔堢敤mutex鍘諱繚鎶ond?

3. signal鐨勪綅緗拰mutex鏈夊叧涔?

4. wait鍑芥暟鍋氫簡浠涔堬紝濡傛灉鍙槸浼戠湢絳夊緟鐨勮瘽銆俻roducer浼氶樆濉炲湪lock鍑芥暟涓婏紙consumer鍏坙ock浜唌utex錛夈?/strong>

izualzhy 2011-11-14 22:40 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁板洓浜掓枼閲?浣跨敤http://m.shnenglu.com/izualzhy/archive/2011/11/13/160047.htmlizualzhyizualzhySun, 13 Nov 2011 14:58:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/13/160047.htmlhttp://m.shnenglu.com/izualzhy/comments/160047.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/13/160047.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160047.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160047.htmlpthread澶氱嚎紼嬪涔犵瑪璁板洓浜掓枼閲?浣跨敤

涓婄瘒絎旇浠嬬粛浜嗕簰鏂ラ噺鐨勫熀鏈畾涔夛紝榪欑瘒涓昏浠嬬粛鍏朵嬌鐢ㄦ柟娉曘?

瀵瑰簲鍏朵綔鐢紝鍏充簬浜掓枼閲忕殑鍑芥暟鏈夎繖涔堝嚑涓細

1. 鍒濆鍖栵細int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);鎴栬匬thread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;//闈欐佸垎閰?

2. 鍔犻攣錛欼nt pthread_mutex_lock(pthread_mutex_t* mutex); Int pthread_mutex_trylock(pthread_mutex_t* mutex);

3. 瑙i攣Int pthread_mutex_unlock(pthread_mutex_t* mutex)

4. 閿姣侊細Int pthread_mutex_destroy(pthread_mutex_t *mutex);

鍏蜂綋鐨勪嬌鐢ㄧ洿鎺ョ湅涓緥瀛愶紝浠庛奤NIX 鐜楂樼駭緙栫▼銆嬩笂鎶勭殑錛?/p>

/*mutex.c*/

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <pthread.h>

#include <errno.h>

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

int lock_var;

time_t end_time;

void pthread1(void *arg);

void pthread2(void *arg);

int main(int argc, char *argv[])

{

pthread_t id1,id2;

pthread_t mon_th_id;

int ret;

end_time = time(NULL) + 10;

/** 浜掓枼閿佸垵濮嬪寲*/

pthread_mutex_init(&mutex,NULL);

/** 鍒涘緩涓や釜綰跨▼*/

ret = pthread_create(&id1,NULL,(void *)pthread1,NULL);

if (ret!=0) {

perror("pthread create error.\n");

exit(-1);

}

ret = pthread_create(&id2,NULL,(void *)pthread2,NULL);

if (ret!=0) {

perror("pthread create error.\n");

}

pthread_join(id1,NULL);

pthread_join(id2,NULL);

pthread_mutex_destroy(&mutex);

exit(0);

}

void pthread1(void *arg)

{

int i;

while (time(NULL) < end_time) {

/** 浜掓枼閿佷笂閿?/

if (pthread_mutex_lock(&mutex)!=0) {

perror("pthread_mutex_lock");

} else {

printf("pthread1:pthread1 lock the variable %d\n",lock_var);

}

for (i=0; i<2; i++) {

sleep(1);

lock_var++;

}

/** 浜掓枼閿佽В閿?/

if (pthread_mutex_unlock(&mutex)!=0) {

perror("pthread_mutex_unlock.");

} else {

printf("pthread1:pthread1 unlock the variable %d\n",lock_var);

}

sleep(1);

}

}

void pthread2(void *arg)

{

int ret;

while (time(NULL) < end_time) {

/** 嫻嬭瘯浜掓枼閿?/

ret = pthread_mutex_trylock(&mutex);

if (ret == EBUSY) {

printf("pthread2:the variable is locked by pthread1\n");

} else {

if (ret!=0) {

perror("pthread_mutex_trylock");

exit(1);

} else {

printf("pthread2:pthread2 got lock. The variable is %d\n",lock_var);

}

if (pthread_mutex_unlock(&mutex)!=0) {

perror("pthread_mutex_unlock");

} else {

printf("pthread2:pthread2 unlock the variable\n");

}

}

sleep(3);

}

}


闇瑕佽鏄庣殑鏈変袱鐐癸細

1. lock鍑芥暟浼氶樆濉炵瓑寰咃紝鐩村埌鑾峰緱閿?

2. trylock鍑芥暟涓嶄細闃誨絳夊緟錛屽鏋滀簰鏂ラ噺褰撳墠琚攣錛屽垯榪斿洖EBUSY鍊箋?

瀹規(guī)槗鍑洪敊鐨勬儏褰細

A

脽 pthread_mutex_lock (theMutex);

脽 pthread_mutex_lock (theMutex);

脽 pthread_mutex_unlock (theMutex);

脽 pthread_mutex_unlock (theMutex);

琛ㄩ潰涓婄湅紼嬪簭鍔犻攣涓ゆ錛岀劧鍚庤В閿佷袱嬈℃病鏈夐敊錛屽疄闄呬笂鍔犻攣絎簩嬈$殑鏃跺欏氨鍑洪敊浜嗐?

B錛?

clip_image002clip_image004

鍗沖瓨鍦ㄥ涓簰鏂ラ噺鏃剁殑闂錛屼袱涓嚎紼嬮兘鍦ㄧ瓑鍦ㄥ彟涓涓嚎紼嬭В閿佹墠鑳界戶緇線涓嬫墽琛屻?

紕板埌榪欑鎯呭喌錛屾垜浠竴鑸害瀹氫竴涓?-2-3鈥︾殑鍔犻攣欏哄簭錛屾墍鏈夌嚎紼嬮兘閬靛畧榪欎竴綰﹀畾鎵嶈銆?

浣嗗嵆浣胯繖鏍鳳紝鏈夋椂鍊欏簲鐢ㄧ▼搴忕殑緇撴瀯浣垮緱瀵逛簰鏂ラ噺鍔犻攣榪涜鎺掑簭鏄緢鍥伴毦鐨勶紝濡傛灉娑夊強浜嗗お澶氱殑閿佸拰鏁版嵁緇撴瀯錛屽彲鐢ㄧ殑鍑芥暟騫朵笉鑳芥妸瀹冭漿鎹㈡垚綆鍗曠殑灞傛錛岄偅涔堝氨闇瑕侀噰鐢ㄥ彟澶栫殑鍔炴硶銆傚彲浠ュ厛閲婃斁鎵鏈夌殑閿侊紝鐒跺悗榪囦竴孌墊椂闂村啀璇曘傝繖縐嶆儏鍐靛彲浠ヤ嬌鐢╬thread_mutex_trylock鎺ュ彛閬垮厤姝婚攣銆?

脽 浜掓枼閿佷竴涓槑鏄劇殑緙虹偣鏄畠鍙湁涓ょ鐘舵侊細閿佸畾鍜岄潪閿佸畾銆傝鎯充竴縐嶇畝鍗曟儏鏅細澶氫釜綰跨▼璁塊棶鍚屼竴涓叡浜祫婧愭椂錛屽茍涓嶇煡閬撲綍鏃跺簲璇ヤ嬌鐢ㄥ叡浜祫婧愶紝濡傛灉鍦ㄤ復鐣屽尯閲屽姞鍏ュ垽鏂鍙ワ紝鎴栬呭彲浠ユ湁鏁堬紝浣嗕竴鏉ユ晥鐜囦笉楂橈紝浜屾潵澶嶆潅鐜涓嬪氨闅句互緙栧啓浜嗭紝榪欐槸鎴戜滑闇瑕佷竴涓粨鏋勶紝鑳藉湪鏉′歡鎴愮珛鏃惰Е鍙戠浉搴旂嚎紼嬶紝榪涜鍙橀噺淇敼鍜岃闂?

閽堝姝ら棶棰橈紝涓嬩竴綃囧紑濮嬪涔犳潯浠跺彉閲忋?

izualzhy 2011-11-13 22:58 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁板洓浜掓枼閲?浠嬬粛http://m.shnenglu.com/izualzhy/archive/2011/11/13/160046.htmlizualzhyizualzhySun, 13 Nov 2011 14:56:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/13/160046.htmlhttp://m.shnenglu.com/izualzhy/comments/160046.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/13/160046.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160046.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160046.htmlpthread澶氱嚎紼嬪涔犵瑪璁板洓浜掓枼閲?浠嬬粛

澶氱嚎紼嬭祫婧愬叡浜彲浠ヨ鏈夊埄鏈夊紛錛岃繖鐐逛粠絎旇涓鍙互娓呮鐨勭湅鍒幫紙瀛愮嚎紼嬩慨鏀瑰唴瀛樺悗錛屼富綰跨▼鍙互鐪嬪埌錛屼絾瀛愮嚎紼媐ree鍚庯紝涓葷嚎紼嬪啀嬈ree灝辨湁闂浜嗭級銆?

鏇寸洿鎺ヤ竴鐐圭殑閿欒錛屽鏋滃瓙綰跨▼淇敼閭e潡鍐呭瓨鐨勬椂鍊欙紝涓葷嚎紼嬪悓鏃跺湪淇敼浼氬彂鐢熶粈涔堢姸鍐點傜瓟妗堟槸錛氫笉紜畾銆傚洜姝わ紝綰跨▼鍚屾鍙樺緱寰堥噸瑕併傝В鍐蟲柟娉曞氨鏄笉鍏佽澶氫釜綰跨▼鍚屾椂鍘諱慨鏀逛竴涓彉閲忋?

脽 褰撲竴涓嚎紼嬩慨鏀瑰彉閲忔椂錛屽叾浠栫嚎紼嬪湪璇誨彇榪欎釜鍙橀噺鐨勫兼椂灝卞彲鑳界湅鍒頒笉涓鏍風殑鏁板箋?

脽 鍦ㄥ彉閲忎慨鏀規(guī)椂闂村浜庝竴涓瓨鍌ㄥ櫒璁塊棶鍛ㄦ湡鐨勫鐞嗗櫒緇撴瀯涓紝褰撳瓨鍌ㄥ櫒璇諱笌瀛樺偍鍣ㄥ啓榪欎袱涓懆鏈熶氦鍙夋椂錛岃繖縐嶆綔鍦ㄧ殑涓嶄竴鑷存у氨浼氬嚭鐜般?

鍥犳寮曞叆浜嗕簰鏂ラ噺銆?

鐪嬩釜渚嬪瓙鍙兘瀹規(guī)槗鐞嗚В涓浜涳細

void *threadA(void *) { i++; }

void *threadB(void *) { i++; }

瀵瑰簲浜庤嚜澧炵殑鎿嶄綔錛?

clip_image002 clip_image004 clip_image006

浠庡乏鍒板彸渚濇涓篈綰跨▼錛孊綰跨▼鍜屾垜浠湅鍒扮殑i鐨勫箋傛í鍚戠殑琛ㄧず鍚屼竴鏃墮棿銆傛垜浠妸榪欑涓涓椂闂寸偣涓奵pu鑳藉畬鎴愮殑鍔ㄤ綔縐頒負鍘熷瓙鎿嶄綔錛岄偅涔堝鏋滄搷浣滀笉鏄師瀛愭搷浣滄椂錛屼笉涓鑷存у氨鍑虹幇浜嗐?

鍚堢悊鐨勫姙娉曟槸褰揂綰跨▼淇敼i鐨勬椂鍊欙紝B綰跨▼搴斿綋闃誨絳夊緟錛岀洿鍒癆綰跨▼淇敼瀹屾瘯錛孊綰跨▼鍐嶅紑濮嬩慨鏀廣傛垨鑰匒鍘葷瓑寰匓瀹屾垚銆?

灝卞儚鏄攣錛孉錛孊鍘諱慨鏀筰鐨勬椂鍊欓兘灝濊瘯鍘婚攣浣廼錛屽鏋渋澶勪簬娌¤閿佷綇錛堣В閿侊級鐘舵侊紝鍒欏彲浠ラ攣涓婏紝鑻澶勪簬閿佷綇鐘舵侊紝鍒欓樆濉炵瓑寰呯洿鍒癷琚埆鐨勭嚎紼嬪紑閿佸悗鍙互閿佷綇i涓烘銆?

鎴戝垰寮濮嬬悊瑙d負浜掓枼閲忓氨鏄敤鏉ヤ繚鎶や竴涓彉閲忕殑錛屽悗鏉ュ彂鐜版槸閿欒鐨勩?

灝卞儚濡傛灉B灝濊瘯鍘諱慨鏀筰鐨勬椂鍊欐病鏈夊厛灝濊瘯鍘葷粰浜掓枼閲忓姞閿侊紝涓鏍峰彲浠ヤ慨鏀筰錛屼竴鏍蜂細浜х敓闂銆傘傘?

鍥犳浜掓枼閲忓姞閿侊紝瑙i攣鐨勪綅緗兘鏄敱鎴戜滑鑷繁鏉ョ‘瀹氱殑銆?

鎴戠殑鐞嗚В鏄紝浜掓枼閲忓彲浠ラ攣浣忎竴鍧楀尯鍩燂紝鍥犳鎶涘紑鍙橀噺鏉ヨВ閲婏紝鏈鐩磋鐨勫氨鏄紝褰撶嚎紼婣鎵ц鏌愭浠g爜鏃訛紝涓嶅笇鏈涘埆鐨勭嚎紼嬪悓鏃舵潵淇敼鍏惰璇誨彇鎴栬呬慨鏀圭殑鍙橀噺錛堝彲鑳芥湁澶氫釜錛夛紝鍥犳瀵逛簰鏂ラ噺鍔犻攣錛岀洿鍒拌繖孌典唬鐮佺粨鏉燂紝鍐嶅鍏惰В閿併傝繖鏍峰氨涓瀹氱鐢ㄥ悧錛熷鏋滅嚎紼婤鎵ц鐨勬煇孌典唬鐮佸彲鑳戒細淇敼綰跨▼A鎵涓嶅笇鏈涘埆鐨勭嚎紼嬫墍淇敼鐨勯偅浜涘彉閲忥紝鑰岀嚎紼婤鍙堟病鏈夊厛灝濊瘯鍔犻攣錛堢湅涓嬫湁娌℃湁綰跨▼宸查攣浣忎簰鏂ラ噺錛岃嫢鏈夛紝鍒欓渶瑕侀樆濉炵瓑寰咃級鐨勮瘽錛岀粨鏋滃茍涓嶇‘瀹氾紝浜掓枼閲忔槸涓嶄細璧蜂綔鐢ㄧ殑銆傚洜姝わ紝榪欐洿鍍忔槸涓滃悰瀛愬崗瀹氣濓紙浠庝竴綃囨暀紼嬮噷鐪嬪埌鐨勶紝榪樻尯璐村垏銆傘傘傘傘傘傦級錛屽浣曠‘淇濈▼搴忔紜紝鍦ㄥ摢涓嚎紼嬪摢閲屽姞閿佷笌瑙i攣閮介渶瑕佸啓紼嬪簭鐨勪漢鏉ヤ繚璇併備簰鏂ラ噺鐨勪綔鐢ㄤ粎浠呮槸鍔犻攣涓庤В閿併?

鐪熷暟鍡︺傘傘備笉榪囨垜紜疄鐪嬩簡鍑犱釜渚嬪瓙鍚庢墠鏄庣櫧銆傘傘?

浣跨敤浜掓枼閲忓厛鐪嬩釜渚嬪瓙錛?

鍗曞疄渚嬫ā寮忥紙鍦ㄧ湅涓鏈璁℃ā寮忎功鐨勬椂鍊欑湅鍒扮殑錛?/p>

#include <pthread.h>

#include <stdio.h>

#include <unistd.h>

class Test {

public:

static Test* instance() {

if (NULL == m_instance) {

sleep(1);

printf("m_instance is NULL\n");

m_instance = new Test;

}

return m_instance;

}

static Test* m_instance;

void print(char* tip)

{

printf("In: %s,Test print %x\n",tip,m_instance);

printf("tid: %x\n",pthread_self());

}

private:

Test() {}

Test(const Test& ) {}

};

Test* Test::m_instance = NULL;

void *thr_fn(void* arg)

{

Test::instance()->print("thread");

return ((void*)0);

}

int main()

{

int err;

pthread_t tid;

err = pthread_create(&tid, NULL, thr_fn, NULL);

Test::instance()->print("main thread1");

Test::instance()->print("main thread2");

sleep(2);

return 0;

}


緇撴灉浼氫駭鐢熶袱涓疄渚嬶紝鏄劇劧涓嶆槸鎴戜滑鎯寵鐨勩?

if (NULL == m_instance) {

sleep(1);

printf("m_instance is NULL\n");

榪欓噷褰撳彂鐜癿_instance涓虹┖鍚庯紝浼戠湢1s錛岀劧鍚巒ew鍑轟竴涓柊鐨勫嚭鏉ャ?

褰撲袱涓嚎紼嬭繍琛屽埌榪欓噷錛坰leep(1)鏄壒鎰忓姞鐨勶級銆傛棤璁哄摢涓嚎紼嬪厛璋冪敤璇ュ嚱鏁幫紙涓葷嚎紼嬪紑浜嗗瓙綰跨▼鍚庯紝鎺ョ潃璋冪敤錛屼袱涓殑鏃墮棿涓嶄細瓚呰繃1s......錛変細鍙戠幇m_instance鐨勭‘涓虹┖錛屼簬鏄紤鐪?s錛岀劧鍚巒ew涓涓柊鐨勫嚭鏉ャ傝綰跨▼浼戠湢鐨勬椂鍊欙紝鍚庤皟鐢ㄧ殑綰跨▼鍚屾牱璋冪敤鍒拌繖閲岋紝璺熶箣鍓嶇殑涓鏍鳳紝鍙戠幇涓虹┖錛屼紤鐪?s錛岀劧鍚庨啋鏉ew涓涓備簬鏄袱涓嚎紼嬩紤鐪犻啋鏉ョ殑鏃跺欓兘浼氬彇new涓涓疄渚嬪嚭鏉ャ傚嵆浜х敓涓や釜鍗曞疄渚嬬殑鍘熷洜銆傚綋鐒跺彲鑳借窡sleep錛?錛夋湁鐫鍏崇郴錛屼絾鍦ㄨ澶氬疄闄呴」鐩噷錛岃繖縐嶆儏鍐靛緢鏄庢樉鏄閬垮厤鐨勩?

浜х敓鐨勫師鍥犲叾瀹炶窡涔嬪墠i++鐩稿悓錛屽垽鏂殑鍜岃皟鐢ㄥ茍涓嶆槸涓涓師瀛愭搷浣溿?

濡傛灉鎴戜滑灝濊瘯鍘誨啓涓嬩簰鏂ラ噺鍔犻攣鍜岃В閿佷袱涓搷浣滅殑浼唬鐮侊細

lock:

if (mutex > 0) {//mutex = 1琛ㄧず絀洪棽

mutex = 0;

return 0;

} else

鎸傝搗絳夊緟;

goto lock;

unlock:

mutex = 1;

鍞ら啋絳夊緟Mutex鐨勭嚎紼?

return 0;

鍙互鐪嬪埌璺熻繖涓緥瀛愪竴鏍鳳紝if鍒ゆ柇鍜岃皟鐢ㄥ茍涓嶆槸涓涓師瀛愭搷浣溿傚洜姝や簰鏂ラ噺鍏蜂綋瀹炵幇鏄繖鏍風殑錛?

脽 涓轟簡瀹炵幇浜掓枼閿佹搷浣滐紝澶у鏁頒綋緋葷粨鏋勯兘鎻愪緵浜唖wap鎴杄xchange鎸囦護錛岃鎸囦護鐨勪綔鐢ㄦ槸鎶婂瘎瀛樺櫒鍜屽唴瀛樺崟鍏冪殑鏁版嵁鐩鎬氦鎹紝鐢變簬鍙湁涓鏉℃寚浠わ紝淇濊瘉浜嗗師瀛愭э紝鍗充嬌鏄澶勭悊鍣ㄥ鉤鍙幫紝璁塊棶鍐呭瓨鐨勬葷嚎鍛ㄦ湡涔熸湁鍏堝悗錛屼竴涓鐞嗗櫒涓婄殑浜ゆ崲鎸囦護鎵ц鏃跺彟涓涓鐞嗗櫒鐨勪氦鎹㈡寚浠ゅ彧鑳界瓑寰呮葷嚎鍛ㄦ湡

瀹為檯涓婁笂闈㈣繖鍙ヨ瘽鎴戝嚑涔庢病鐪嬫噦錛屼笉榪囨病鍏崇郴錛屾垜鎯寵鏄庣殑榪樻槸閭e彞璇濓紝浜掓枼閲忕殑浣滅敤鍦ㄨ繖閲岋紙浣夸箣鎴愪負浜嗗師瀛愭搷浣滐級錛岃屽鍙橀噺鐨勪繚鎶ら渶瑕佸啓浠g爜鐨勪漢錛堥伒寰墍璋撶殑鈥滃悰瀛愬崗璁濓級鏉ュ畬鎴愩?

izualzhy 2011-11-13 22:56 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁頒笁綰跨▼娓呯悊澶勭悊紼嬪簭http://m.shnenglu.com/izualzhy/archive/2011/11/13/160045.htmlizualzhyizualzhySun, 13 Nov 2011 14:53:00 GMThttp://m.shnenglu.com/izualzhy/archive/2011/11/13/160045.htmlhttp://m.shnenglu.com/izualzhy/comments/160045.htmlhttp://m.shnenglu.com/izualzhy/archive/2011/11/13/160045.html#Feedback0http://m.shnenglu.com/izualzhy/comments/commentRss/160045.htmlhttp://m.shnenglu.com/izualzhy/services/trackbacks/160045.htmlpthread澶氱嚎紼嬪涔犵瑪璁頒笁綰跨▼娓呯悊澶勭悊紼嬪簭

綰跨▼鍙互瀹夋帓鑷繁閫鍑烘椂(鏌愪簺鎯呭喌涓嬬殑閫鍑?鐨勫洖璋冨嚱鏁般?

Void pthread_cleanup_push(void (*rtn)(void*),void *arg);

Void pthread_pop(int execute);

榪欎笌榪涚▼鍙互鐢╝texit鍑芥暟瀹夋帓榪涚▼閫鍑烘椂闇瑕佽皟鐢ㄧ殑鍑芥暟鏄被浼肩殑銆傝繖鏍風殑鍑芥暟縐頒負綰跨▼娓呯悊澶勭悊紼嬪簭(thread cleanup handler)銆?

鍏堢湅涓嬭繖涓や釜鍑芥暟鐨勫疄鐜幫細

/* Install a cleanup handler: ROUTINE will be called with arguments ARG

when the thread is canceled or calls pthread_exit. ROUTINE will also

be called with arguments ARG when the matching pthread_cleanup_pop

is executed with non-zero EXECUTE argument.

pthread_cleanup_push and pthread_cleanup_pop are macros and must always

be used in matching pairs at the same nesting level of braces. */

# define pthread_cleanup_push(routine, arg) \

do { \

__pthread_cleanup_class __clframe (routine, arg)

/* Remove a cleanup handler installed by the matching pthread_cleanup_push.

If EXECUTE is non-zero, the handler function is called. */

# define pthread_cleanup_pop(execute) \

__clframe.__setdoit (execute); \

} while (0)

鎴戜粠pthread.h閲岀粰鐓ф惉榪囨潵浜嗭紝涓昏鏄兂璇存槑榪欎袱涓嚱鏁板疄鐜頒負瀹忥紝瑕佹垚瀵逛嬌鐢紝鑻辨枃瑙i噴閲屽緢鏄庣‘浜嗗懙鍛點?

娉ㄦ剰錛?

1. 綰跨▼鍙互寤虹珛澶氫釜娓呯悊澶勭悊紼嬪簭錛屽鐞嗙▼搴忚褰曞湪鏍堜腑錛屼篃灝辨槸璇村畠浠殑鎵ц欏哄簭涓庡畠浠殑娉ㄥ唽欏哄簭鐩稿弽銆?

  1. 褰撶嚎紼嬫墽琛屼互涓嬪姩浣滄椂璋冪敤

1璋冪敤pthread_exit鏃?

2鍝嶅簲鍙栨秷璇鋒眰鏃?

3鐢ㄩ潪闆秂xecute鍙傛暟璋冪敤pthread_cleanup_pop鏃躲?

鍙互鐪嬪埌return鏃跺茍涓嶄細璋冪敤銆?

3. 濡傛灉execute鍙傛暟緗?錛屾竻鐞嗗嚱鏁頒笉琚皟鐢ㄣ傛棤璁哄摢縐嶆儏鍐碉紝pthread_cleanup_pop閮藉皢鍒犻櫎涓婃pthread_cleanup_push璋冪敤寤虹珛鐨勬竻鐞嗗鐞嗙▼搴忋?

鐩存帴鐪嬩釜渚嬪瓙,<UNIX 鐜楂樼駭緙栫▼涓婄殑>:

#include <stdio.h>

#include <stdlib.h>

#include <pthread.h>

void cleanup(void *arg)

{

printf("cleanup: %s\n",(char *)arg);

}

void *thr_fn1(void *arg)

{

printf("thread 1 start\n");

pthread_cleanup_push(cleanup, "thread 1 first handler");

pthread_cleanup_push(cleanup, "thread 1 second handler");

printf("thread 1 push complete\n");

if (arg)

return((void *)1);

pthread_cleanup_pop(0);

pthread_cleanup_pop(0);

return((void *)1);

}

void *thr_fn2(void *arg)

{

printf("thread 2 start\n");

pthread_cleanup_push(cleanup, "thread 2 first handler");

pthread_cleanup_push(cleanup, "thread 2 second handler");

printf("thread 2 push complete\n");

if (arg)

pthread_exit((void *)2);

pthread_cleanup_pop(0);

pthread_cleanup_pop(0);

pthread_exit((void *)2);

}

int main(void)

{

int err;

pthread_t tid1,tid2;

void *tret;

err = pthread_create(&tid1, NULL, thr_fn1, (void *)1);

if (err != 0) {

printf("can't create thread 1: %s\n",strerror(err));

exit(-1);

}

err = pthread_create(&tid2, NULL, thr_fn2, (void *)1);

if (err != 0) {

printf("can't create thread 2: %s\n",strerror(err));

exit(-1);

}

err = pthread_join(tid1, &tret);

if (err != 0) {

printf("can't join with thread 1: %s\n",strerror(err));

exit(-1);

}

printf("thread 1 exit code %d\n",(int)tret);

err = pthread_join(tid2, &tret);

if (err != 0) {

printf("can't join with thread 2: %s\n",strerror(err));

exit(-1);

}

printf("thread 2 exit code %d\n",(int)tret);

}


Technorati 鏍囩: ,
izualzhy 2011-11-13 22:53 鍙戣〃璇勮
]]>
pthread澶氱嚎紼嬪涔犵瑪璁頒簩綰跨▼緇堟銆佸彇娑堜笌鑾峰緱榪斿洖鐘舵?/title><link>http://m.shnenglu.com/izualzhy/archive/2011/11/13/160024.html</link><dc:creator>izualzhy</dc:creator><author>izualzhy</author><pubDate>Sun, 13 Nov 2011 07:05:00 GMT</pubDate><guid>http://m.shnenglu.com/izualzhy/archive/2011/11/13/160024.html</guid><wfw:comment>http://m.shnenglu.com/izualzhy/comments/160024.html</wfw:comment><comments>http://m.shnenglu.com/izualzhy/archive/2011/11/13/160024.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/izualzhy/comments/commentRss/160024.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/izualzhy/services/trackbacks/160024.html</trackback:ping><description><![CDATA[<p style="margin: 0cm 0cm 0pt"><strong>pthread</strong>澶氱嚎紼嬪涔犵瑪璁頒簩綰跨▼緇堟銆佸彇娑堜笌鑾峰緱榪斿洖鐘舵?/p><br /><br /> <p>涓婄瘒絎旇閲屽彲浠ョ湅鍒扮嚎紼嬪嚱鏁扮殑寮濮嬪拰緇撴潫鎰忓懗鐫綰跨▼鐨勫紑濮嬪拰緇堟錛岄偅涔堝氨鏈変竴涓棶棰橈紝鍚屽叾浠栨櫘閫氬嚱鏁頒竴鏍鳳紝濡備綍鑾峰緱綰跨▼榪斿洖鏃剁殑鐘舵侊紵</p> <p>濡傛灉瀛愮嚎紼嬭繍琛岃繃紼嬩腑錛屼富綰跨▼闇瑕佸彇娑堝瓙綰跨▼錛岃濡備綍鍋氾紵</p> <p>瀛愮嚎紼嬮鍑烘柟寮忔湁鍝簺錛?/p><br /> <p>ß 濡傛灉闇瑕佸彧緇堟鏌愪釜綰跨▼鑰屼笉緇堟鏁翠釜榪涚▼錛屽彲浠ユ湁涓夌鏂規(guī)硶錛?/p> <p>1.浠庣嚎紼嬪嚱鏁皉eturn銆傝繖縐嶆柟娉曞涓葷嚎紼嬩笉閫傜敤錛屼粠main鍑芥暟return鐩稿綋浜庤皟鐢╡xit銆?濡傛灉榪涚▼涓換涓綰跨▼璋冪敤浜唀xit,_Exit鎴栬卂exit,閭d箞鏁翠釜榪涚▼灝變細緇堟銆?</p> <p>2.涓涓嚎紼嬪彲浠ヨ皟鐢╬thread_cancel緇堟鍚屼竴榪涚▼涓殑鍙︿竴涓嚎紼嬨?/p> <p>3.綰跨▼鍙互璋冪敤pthread_exit緇堟鑷繁</p><br /> <p>鍙互鐢╬thread_join絳夊緟綰跨▼緇撴潫騫惰幏寰楀叾榪斿洖鍊鹼細</p> <p>ß int pthread_join(pthread_t thread, void **rval_ptr)</p> <p>榪斿洖鍊鹼細鎴愬姛榪斿洖0錛屽け璐ヨ繑鍥為敊璇彿(ESRCH,EINVAL絳?</p> <p>ß 閫氳繃pthread_join寰楀埌鐨勭粓姝㈢姸鎬佹槸涓嶅悓鐨勶紝鎬葷粨濡備笅錛?/p> <p>1.濡傛灉thread綰跨▼閫氳繃return榪斿洖錛宺val_ptr鎵鎸囧悜鐨勫崟鍏冮噷瀛樻斁鐨勬槸thread綰跨▼鍑芥暟鐨勮繑鍥炲箋?/p> <p>2. 濡傛灉thread綰跨▼琚埆鐨勭嚎紼嬭皟鐢╬thread_cancel寮傚父緇堟鎺夛紝rval_ptr鎵鎸囧悜鐨勫崟鍏冮噷瀛樻斁鐨勬槸甯告暟PTHREAD_CANCELED銆?/p> <p>3.濡傛灉thread綰跨▼鏄嚜宸辮皟鐢╬thread_exit緇堟鐨勶紝rval_ptr鎵鎸囧悜鐨勫崟鍏冨瓨鏀劇殑鏄紶緇檖thread_exit鐨勫弬鏁般?/p> <p>ß 濡傛灉瀵箃hread綰跨▼鐨勭粓姝㈢姸鎬佷笉鎰熷叴瓚o紝鍙互浼燦ULL緇檙val_ptr鍙傛暟銆?/p> <p>鍚屼箣鍓嶄竴鏍鳳紝姣忎釜鍑芥暟鍏蜂綋鐨勮В閲婂氨涓嶈褰曞湪榪欓噷浜嗭紝寰堝鏁欑▼涓婃湁錛?usr/include/pthread.h鏂囦歡閲屼篃鍙互鐪嬪埌綆鍗曠殑娉ㄨВ銆?/p> <p>娉ㄦ剰榪欎釜鍑芥暟鍜岃繘紼嬮噷鐨剋aitpid寰堝儚銆?/p> <p>璋冪敤榪欎釜鍑芥暟鍏跺疄鏈変袱涓師鍥狅細</p> <p>1. 鑾峰緱綰跨▼榪斿洖鍊鹼紝瀛樺湪絎簩涓弬鏁伴噷錛堟寚鍚戞寚閽堢殑鎸囬拡錛夈?/p> <p>2. 濡傛灉涓嶆兂鑾峰緱鍑芥暟閫鍑虹姸鎬侊紝鍙槸鍗曠函鐨勬兂絳夊緟綰跨▼緇撴潫錛屽彲浠ヤ紶NULL緇欏畠銆傝璇存槑鐨勬槸錛屼竴涓嚎紼嬩笉鑳借澶氫釜綰跨▼絳夊緟錛屽惁鍒欑涓涓帴鏀跺埌淇″彿鐨勭嚎紼嬫垚鍔熻繑鍥烇紝鍏朵綑璋冪敤pthread_join鐨勭嚎紼嬪垯榪斿洖閿欒浠g爜ESRCH銆?/p> <p>涓鑸儏鍐典笅錛岀嚎紼嬬粓姝㈠悗錛屽叾緇堟鐘舵佷竴鐩翠繚鐣欏埌鍏跺畠綰跨▼璋冪敤pthread_join鑾峰彇瀹冪殑鐘舵佷負姝€傚洜姝ょ敤榪欎釜鍑芥暟鍙栫瓑寰呯嚎紼嬬粨鏉熸槸蹇呰鐨勶紝鍏蜂綋緋葷粺鍥炴敹鐨勬槸閭i儴鍒嗚祫婧愮嚎紼嬪睘鎬ч噷鍙互浣撶幇鐨勫緢鏄庢樉錛屽綋鐒惰偗瀹氬氨鏄嚎紼嬬嫭鏈夌殑閭i儴鍒嗚祫婧?#8230;…浣嗘槸綰跨▼涔熷彲浠ヨ緗負detach鐘舵侊紝榪欐牱鐨勭嚎紼嬩竴鏃︾粓姝㈠氨绔嬪埢鍥炴敹瀹冨崰鐢ㄧ殑鎵鏈夎祫婧愶紝鑰屼笉淇濈暀緇堟鐘舵併備笉鑳藉涓涓凡緇忓浜巇etach鐘舵佺殑綰跨▼璋冪敤pthread_join錛岃繖鏍風殑璋冪敤灝嗚繑鍥濫INVAL銆傚涓涓皻鏈猟etach鐨勭嚎紼嬭皟鐢╬thread_join鎴杙thread_detach閮藉彲浠ユ妸璇ョ嚎紼嬬疆涓篸etach鐘舵侊紝涔熷氨鏄錛屼笉鑳藉鍚屼竴綰跨▼璋冪敤涓ゆpthread_join錛屾垨鑰呭鏋滃凡緇忓涓涓嚎紼嬭皟鐢ㄤ簡pthread_detach灝變笉鑳藉啀璋冪敤pthread_join浜嗐傛湁鍏磋叮鐨勫悓瀛﹀彲浠ュ仛涓瘯楠岋紝鐪嬩笅鍦ㄥ姣忎釜綰跨▼璁劇疆涓篸etach鐘舵佸墠鍚庣郴緇熷彲浠ュ紑鐨勬渶澶х嚎紼嬫暟鐩姣旓紝鐪嬩笅鏄惁綰跨▼璧勬簮鍥炴敹鏄繀瑕佺殑銆?/p> <p>絎簩鐐瑰ソ鍍忓お鍟板棪浜嗭紙瀛︾殑涓鐭ュ崐瑙c傘傦級錛屼笉榪囨劅瑙夋渶涓昏鐨勬槸涔熷氨鏄榪欓噷銆傘傘傘?/p><br /><br /> <p>鍙栨秷綰跨▼錛?/p> <p>int pthread_cancel(pthread_t tid);</p> <p>ß 綰跨▼鍙互閫氳繃璋冪敤璇ュ嚱鏁版潵璇鋒眰鍙栨秷鍚屼竴榪涚▼涓殑鍏朵粬綰跨▼銆?/p> <p>ß 鍦ㄩ粯璁ゆ儏鍐典笅錛宲thread_cancel鍑芥暟浼氫嬌寰楃敱tid鏍囪瘑鐨勭嚎紼嬬殑琛屼負琛ㄧ幇涓哄鍚岃皟鐢ㄤ簡鍙傛暟涓篜THREAD_CANCELED鐨刾thread_exit鍑芥暟錛屼絾鏄嚎紼嬪彲浠ラ夋嫨蹇界暐鍙栨秷鏂瑰紡鎴栨槸鎺у埗鍙栨秷鏂瑰紡銆傛敞鎰弍thread_cancel騫朵笉絳夊緟綰跨▼緇堟錛屽畠浠呬粎鎻愬嚭璇鋒眰銆?/p> <p>娉ㄦ剰錛?/p> <p>1. #define PTHREAD_CANCELED ((void *) -1)錛屽洜姝ゆ鏃墮氳繃join鑾峰緱榪斿洖鍊煎叾瀹炲氨鏄?1.</p> <p>2. 璇ュ嚱鏁頒粎浠呮槸鎻愬嚭璇鋒眰銆傚叿浣撹鍙栨秷綰跨▼鐨勫姩浣滆窡鍏剁嚎紼嬪睘鎬х浉鍏熾?/p> <p>渚嬪瓙錛?/p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #cc6633">#include</span> <pthread.h><br /><br /><span style="color: #cc6633">#include</span> <stdio.h><br /><br /><br /><br /><br /><span style="color: #0000ff">void</span> cleanup(<span style="color: #0000ff">void</span> *arg)<br /><br />{<br /><br />printf(<span style="color: #006080">"clean up \n"</span>);<br /><br />}<br /><br /><span style="color: #0000ff">char</span> c = <span style="color: #006080">'a'</span>;<br /><br /><br /><br /><br /><span style="color: #0000ff">void</span> *print(<span style="color: #0000ff">void</span> *arg)<br /><br />{<br /><br /><span style="color: #0000ff">int</span> i;<br /><br />pthread_cleanup_push(cleanup,NULL);<br /><br /><span style="color: #0000ff">for</span> ( i=0; i<10; ++i) {<br /><br />printf(<span style="color: #006080">"%s\n"</span>,(<span style="color: #0000ff">char</span> *)arg);<br /><br />sleep(2);<br /><br />}<br /><br /><br /><br /><br />pthread_exit((<span style="color: #0000ff">void</span> *)c);<br /><br />pthread_cleanup_pop(0);<br /><br /><span style="color: #008000">/*exit(NULL);*/</span><br /><br />}<br /><br /><br /><br /><br /><span style="color: #0000ff">int</span> main()<br /><br />{<br /><br />pthread_t pid;<br /><br />pthread_create(&pid,NULL,print,<span style="color: #006080">"hello world."</span>);<br /><br /><span style="color: #008000">/*pthread_detach(pid);*/</span><br /><br /><span style="color: #0000ff">int</span> i;<br /><br /><span style="color: #0000ff">for</span>( i=0; i<10; i++) {<br /><br />printf(<span style="color: #006080">"I'm main thread\n"</span>);<br /><br />sleep(1);<br /><br />}<br /><br /><span style="color: #0000ff">void</span> *ret;<br /><br /><span style="color: #008000">/*pthread_cancel(pid);*/</span><br /><br /><span style="color: #0000ff">int</span> r = pthread_join(pid,&ret);<br /><br /><span style="color: #0000ff">if</span> (r != 0) {<br /><br />printf(<span style="color: #006080">"join error: %s\n"</span>,strerror(r));<br /><br />}<br /><br /><span style="color: #008000">/*r = pthread_join(pid,&ret);*/</span><br /><br /><span style="color: #008000">/*if (r != 0) {*/</span><br /><br /><span style="color: #008000">/*printf("join error: %s\n",strerror(r));*/</span><br /><br /><span style="color: #008000">/*}*/</span><br /><br />printf(<span style="color: #006080">"%d\n"</span>,(<span style="color: #0000ff">int</span>*)ret);<br /><br /><br /><br /><br /><span style="color: #0000ff">return</span> 0;<br /><br />}<br /><br /></pre></div> <p>榪欎釜渚嬪瓙閲屾敞閲婃帀鐨勯儴鍒嗘槸鎴戠敤鏉ユ祴璇曡繖綃囩瑪璁伴噷澶ч儴鍒嗘劅瑙夎娉ㄦ剰鐨勫湴鏂圭殑</p><img src ="http://m.shnenglu.com/izualzhy/aggbug/160024.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/izualzhy/" target="_blank">izualzhy</a> 2011-11-13 15:05 <a href="http://m.shnenglu.com/izualzhy/archive/2011/11/13/160024.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pthread澶氱嚎紼嬪涔犵瑪璁頒竴綰跨▼鍒涘緩綃?/title><link>http://m.shnenglu.com/izualzhy/archive/2011/11/13/160022.html</link><dc:creator>izualzhy</dc:creator><author>izualzhy</author><pubDate>Sun, 13 Nov 2011 06:59:00 GMT</pubDate><guid>http://m.shnenglu.com/izualzhy/archive/2011/11/13/160022.html</guid><wfw:comment>http://m.shnenglu.com/izualzhy/comments/160022.html</wfw:comment><comments>http://m.shnenglu.com/izualzhy/archive/2011/11/13/160022.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/izualzhy/comments/commentRss/160022.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/izualzhy/services/trackbacks/160022.html</trackback:ping><description><![CDATA[<p align="left"><span style="font-family: 'Calibri','sans-serif'; font-size: 1pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA" lang="EN-US"><w:sdtPr></w:sdtPr><w:Sdt id="89512082" title="鏂囩珷鏍囬" storeitemid="X_BC6F93BF-22BA-4949-BB97-A5EE037A3898" text="t" docpart="C25491BD112C4FE9897CCA633A925D19" xpath="/ns0:BlogPostInfo/ns0:PostTitle"></span><font face="瀹嬩綋"> </font> </p> <p style="margin: 0cm 0cm 0pt" class="Publishwithline"><strong><font size="5"><font color="#17365d"><span lang="EN-US">pthread</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: major-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: major-latin">澶氱嚎紼嬪涔犵瑪璁頒竴綰跨▼鍒涘緩綃?/span><span lang="EN-US"><w:sdtPr></w:sdtPr></span></font></font></strong></p> <p align="left"></w:Sdt> </p> <div style="border-bottom: #4f81bd 1pt solid; border-left: medium none; padding-bottom: 2pt; padding-left: 0cm; padding-right: 0cm; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-border-bottom-themecolor: accent1; mso-element: para-border-div"> <p style="margin: 2pt 0cm 0pt" class="underline"><span lang="EN-US"><o:p><font size="1"> </font></o:p></span></p></div> <p style="margin: 0cm 0cm 6pt" class="PadderBetweenControlandBody"><span lang="EN-US"><o:p><font size="1"> </font></o:p></span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏈榪戝湪瀛︿範</span><span lang="EN-US">Linux</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">澶氱嚎紼嬬紪紼嬮儴鍒嗭紝絎旇涔嬩竴錛?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼搴撳嚱鏁版槸鐢?/span><span lang="EN-US">POSIX</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏍囧噯瀹氫箟鐨勶紝縐頒負</span><span lang="EN-US">POSIX thread</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鎴栬?/span><span lang="EN-US">pthread</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">銆傚湪</span><span lang="EN-US">Linux</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">涓婄嚎紼嬪嚱鏁頒綅浜?/span><span lang="EN-US">libpthread</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍏變韓搴撲腑錛屽洜姝ゅ湪緙栬瘧鏃惰鍔犱笂</span><span lang="EN-US">-lpthread</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">閫夐」銆?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">涓庤繘紼嬬浉姣旓細</span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">姣忎釜榪涚▼閮芥嫢鏈夎嚜宸辯殑鏁版嵁孌點佷唬鐮佹鍜屽爢鏍堟</span><span lang="EN-US">,</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪欏氨閫犳垚浜嗚繘紼嬪湪榪涜鍒囨崲絳夋搷浣滄椂閮介渶瑕佹湁姣旇緝璐熻矗鐨勪笂涓嬫枃鍒囨崲絳夊姩浣溿傝繍琛屼簬涓涓繘紼嬩腑鐨勫涓嚎紼嬶紝瀹冧滑褰兼涔嬮棿浣跨敤鐩稿悓鐨勫湴鍧絀洪棿錛屽叡浜ぇ閮ㄥ垎鏁版嵁錛屽惎鍔ㄤ竴涓嚎紼嬫墍鑺辮垂鐨勭┖闂磋繙榪滃皬浜庡惎鍔ㄤ竴涓繘紼嬫墍鑺辮垂鐨勭┖闂達紝鑰屼笖錛岀嚎紼嬮棿褰兼鍒囨崲鎵闇鐨勬椂闂翠篃榪滆繙灝忎簬榪涚▼闂村垏鎹㈡墍闇瑕佺殑鏃墮棿銆?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍏堢湅涓涓畝鍗曠殑澶氱嚎紼嬬殑渚嬪瓙錛?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">娉ㄦ剰璇ヤ緥瀛愪細寮曡搗</span><span lang="EN-US">double free</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨勯棶棰橈紝鏄負浜嗚鏄庝笅綰跨▼鍏變韓鍫嗙殑鎬ц川銆?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span lang="EN-US"></span></p><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin"></p> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #008000">//</span><span style="color: #008000">(gcc –o example example.c –lpthread)</span><span style="color: #008000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" />#include </span><span style="color: #000000"><</span><span style="color: #000000">pthread.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" />#include </span><span style="color: #000000"><</span><span style="color: #0000ff">string</span><span style="color: #000000">.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" />#include </span><span style="color: #000000"><</span><span style="color: #000000">stdio.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" />#include </span><span style="color: #000000"><</span><span style="color: #000000">unistd.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /> <br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" />pthread_t ntid;<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /> <br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">void</span><span style="color: #000000">*</span><span style="color: #000000"> thr_fn(</span><span style="color: #0000ff">void</span><span style="color: #000000">*</span><span style="color: #000000"> arg)<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img id="Codehighlighter1_172_446_Open_Image" onclick="this.style.display='none'; Codehighlighter1_172_446_Open_Text.style.display='none'; Codehighlighter1_172_446_Closed_Image.style.display='inline'; Codehighlighter1_172_446_Closed_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_172_446_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_172_446_Closed_Text.style.display='none'; Codehighlighter1_172_446_Open_Image.style.display='inline'; Codehighlighter1_172_446_Open_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_172_446_Closed_Text"><img src="http://m.shnenglu.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_172_446_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         </span><span style="color: #0000ff">char</span><span style="color: #000000">*</span><span style="color: #000000"> c </span><span style="color: #000000">=</span><span style="color: #000000"> (</span><span style="color: #0000ff">char</span><span style="color: #000000">*</span><span style="color: #000000">)arg;<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         memset(c,</span><span style="color: #000000">'</span><span style="color: #000000">a</span><span style="color: #000000">'</span><span style="color: #000000">,</span><span style="color: #000000">9</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         c[</span><span style="color: #000000">9</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img id="Codehighlighter1_261_291_Open_Image" onclick="this.style.display='none'; Codehighlighter1_261_291_Open_Text.style.display='none'; Codehighlighter1_261_291_Closed_Image.style.display='inline'; Codehighlighter1_261_291_Closed_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_261_291_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_261_291_Closed_Text.style.display='none'; Codehighlighter1_261_291_Open_Image.style.display='inline'; Codehighlighter1_261_291_Open_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif">         </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_261_291_Closed_Text">/**/</span><span id="Codehighlighter1_261_291_Open_Text"><span style="color: #008000">/*</span><span style="color: #008000">printf("ntid: %x\n",ntid);</span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         printf(</span><span style="color: #000000">"</span><span style="color: #000000">thread,pid: %d, tid: %x, %x:%s\n</span><span style="color: #000000">"</span><span style="color: #000000">,getpid(),pthread_self(),(unsigned </span><span style="color: #0000ff">int</span><span style="color: #000000">)arg,(unsigned </span><span style="color: #0000ff">int</span><span style="color: #000000">)c);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         sleep(</span><span style="color: #000000">2</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         free(c);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /> <br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000"> main()<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /><img id="Codehighlighter1_464_1002_Open_Image" onclick="this.style.display='none'; Codehighlighter1_464_1002_Open_Text.style.display='none'; Codehighlighter1_464_1002_Closed_Image.style.display='inline'; Codehighlighter1_464_1002_Closed_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_464_1002_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_464_1002_Closed_Text.style.display='none'; Codehighlighter1_464_1002_Open_Image.style.display='inline'; Codehighlighter1_464_1002_Open_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_464_1002_Closed_Text"><img src="http://m.shnenglu.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_464_1002_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         </span><span style="color: #0000ff">int</span><span style="color: #000000"> err;<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         </span><span style="color: #0000ff">char</span><span style="color: #000000">*</span><span style="color: #000000"> p </span><span style="color: #000000">=</span><span style="color: #000000"> (</span><span style="color: #0000ff">char</span><span style="color: #000000">*</span><span style="color: #000000">)malloc(</span><span style="color: #000000">10</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         printf(</span><span style="color: #000000">"</span><span style="color: #000000">main thread,pid: %d, tid: %x, %x\n</span><span style="color: #000000">"</span><span style="color: #000000">,getpid(),pthread_self(),(unsigned </span><span style="color: #0000ff">int</span><span style="color: #000000">)p);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         err </span><span style="color: #000000">=</span><span style="color: #000000"> pthread_create(</span><span style="color: #000000">&</span><span style="color: #000000">ntid, NULL, thr_fn,(</span><span style="color: #0000ff">void</span><span style="color: #000000">*</span><span style="color: #000000">)p);</span><span style="color: #008000">//</span><span style="color: #008000">pthread.h</span><span style="color: #008000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000"><br /><img id="Codehighlighter1_716_796_Open_Image" onclick="this.style.display='none'; Codehighlighter1_716_796_Open_Text.style.display='none'; Codehighlighter1_716_796_Closed_Image.style.display='inline'; Codehighlighter1_716_796_Closed_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_716_796_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_716_796_Closed_Text.style.display='none'; Codehighlighter1_716_796_Open_Image.style.display='inline'; Codehighlighter1_716_796_Open_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif">         </span><span style="color: #0000ff">if</span><span style="color: #000000"> (err</span><span style="color: #000000">!=</span><span style="color: #000000">0</span><span style="color: #000000">) </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_716_796_Closed_Text"><img src="http://m.shnenglu.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_716_796_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />                   printf(</span><span style="color: #000000">"</span><span style="color: #000000">exit\n</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />                   exit(</span><span style="color: #000000">1</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />         }</span></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         sleep(</span><span style="color: #000000">1</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         printf(</span><span style="color: #000000">"</span><span style="color: #000000">main thread,pid: %d, tid: %x, %x:%s\n</span><span style="color: #000000">"</span><span style="color: #000000">,getpid(),pthread_self(),(unsigned </span><span style="color: #0000ff">int</span><span style="color: #000000">)p,(unsigned </span><span style="color: #0000ff">int</span><span style="color: #000000">)p);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         sleep(</span><span style="color: #000000">10</span><span style="color: #000000">);</span><span style="color: #008000">//</span><span style="color: #008000">絳夊緟綰跨▼緇撴潫</span><span style="color: #008000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         free(p);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />         exit(</span><span style="color: #000000">0</span><span style="color: #000000">);<br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /></span></div> <p style="margin: 0cm 0cm 10pt" class="MsoNormal">鎰熻澶氱嚎紼嬬紪紼嬪彲浠ュ拰榪涚▼鍑芥暟涓璧鋒潵鐪嬶細</span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏈鍩烘湰鐨勫嚑涓嚱鏁版槸濡備笅鍑犱釜錛?/span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; tab-stops: list 36.0pt; mso-list: l1 level1 lfo1" class="MsoNormal"><span style="font-family: 'Wingdings 2'; mso-fareast-font-family: 'Wingdings 2'; mso-bidi-font-family: 'Wingdings 2'" lang="EN-US"><span style="mso-list: Ignore">ß<span style="font: 7pt 'Times New Roman'">  </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼鏍囪瘑</span><span lang="EN-US">: pthread_t pthread_self <span style="mso-tab-count: 1">     </span><span style="mso-spacerun: yes">   </span>pthread_equal</span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; tab-stops: list 36.0pt; mso-list: l1 level1 lfo1" class="MsoNormal"><span style="font-family: 'Wingdings 2'; mso-fareast-font-family: 'Wingdings 2'; mso-bidi-font-family: 'Wingdings 2'" lang="EN-US"><span style="mso-list: Ignore">ß<span style="font: 7pt 'Times New Roman'">  </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼鍒涘緩</span><span lang="EN-US">:pthrea_create</span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; tab-stops: list 36.0pt; mso-list: l1 level1 lfo1" class="MsoNormal"><span style="font-family: 'Wingdings 2'; mso-fareast-font-family: 'Wingdings 2'; mso-bidi-font-family: 'Wingdings 2'" lang="EN-US"><span style="mso-list: Ignore">ß<span style="font: 7pt 'Times New Roman'">  </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼緇堟</span><span lang="EN-US">:pthread_exit pthread_join</span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; tab-stops: list 36.0pt; mso-list: l1 level1 lfo1" class="MsoNormal"><span style="font-family: 'Wingdings 2'; mso-fareast-font-family: 'Wingdings 2'; mso-bidi-font-family: 'Wingdings 2'" lang="EN-US"><span style="mso-list: Ignore">ß<span style="font: 7pt 'Times New Roman'">  </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼鍙栨秷</span><span lang="EN-US">:pthread_cancel</span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; tab-stops: list 36.0pt; mso-list: l1 level1 lfo1" class="MsoNormal"><span style="font-family: 'Wingdings 2'; mso-fareast-font-family: 'Wingdings 2'; mso-bidi-font-family: 'Wingdings 2'" lang="EN-US"><span style="mso-list: Ignore">ß<span style="font: 7pt 'Times New Roman'">  </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼娓呯悊</span><span lang="EN-US">:pthread_cleanup_push pthread_cleanup_pop</span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; tab-stops: list 36.0pt; mso-list: l1 level1 lfo1" class="MsoNormal"><span style="font-family: 'Wingdings 2'; mso-fareast-font-family: 'Wingdings 2'; mso-bidi-font-family: 'Wingdings 2'" lang="EN-US"><span style="mso-list: Ignore">ß<span style="font: 7pt 'Times New Roman'">  </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼鍒嗙灞炴?/span><span lang="EN-US">:pthread_detach </span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">寰堝涔﹂噷閮戒細璁插埌鍏剁敤娉曘傚湪</span><span lang="EN-US">/usr/include/pthread.h</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">涓嬩篃鍙互鐩存帴鐪嬪埌鍏跺嚱鏁板0鏄庡拰鍩烘湰鐨勪粙緇嶃?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪欓噷鍙褰曚笅鎴戝涔犺繃紼嬩腑瑙夊緱瑕佹敞鎰忕殑鍑犱釜鍦版柟錛?/span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt; mso-add-space: auto; mso-list: l0 level1 lfo2" class="MsoListParagraphCxSpFirst"><span style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin" lang="EN-US"><span style="mso-list: Ignore">1.<span style="font: 7pt 'Times New Roman'">       </span></span></span><span lang="EN-US">pthread_create</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨勫弬鏁頒粙緇嶏細</span><span lang="EN-US"><br />int pthread_create(pthread_t *tidp, const pthread_attr_t *attr, void *(*start_rtn)(void *),void *arg)</span></p> <p style="margin: 0cm 0cm 0pt 18pt; mso-add-space: auto" class="MsoListParagraphCxSpMiddle"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">涓涓嚎紼嬩腑璋冪敤</span><span lang="EN-US">pthread_create()</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍒涘緩鏂扮殑綰跨▼鍚庯紝褰撳墠綰跨▼浠?/span><span lang="EN-US">pthread_create()</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪斿洖緇х畫寰涓嬫墽琛岋紝鑰屾柊鐨勭嚎紼嬫墍鎵ц鐨勪唬鐮佺敱鎴戜滑浼犵粰</span><span lang="EN-US">pthread_create</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨勫嚱鏁版寚閽?/span><span lang="EN-US">start_rtn</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍐沖畾銆?/span><span lang="EN-US">start_rtn</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍑芥暟鎺ユ敹涓涓弬鏁幫紝鏄氳繃</span><span lang="EN-US">pthread_create</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨?/span><span lang="EN-US">arg</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍙傛暟浼犻掔粰瀹冪殑錛岃鍙傛暟鐨勭被鍨嬩負</span><span lang="EN-US">void *</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">錛岃繖涓寚閽堟寜浠涔堢被鍨嬭В閲婄敱璋冪敤鑰呰嚜宸卞畾涔夈?/span><span lang="EN-US">start_routine</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨勮繑鍥炲肩被鍨嬩篃鏄?/span><span lang="EN-US">void *</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">錛岃繖涓寚閽堢殑鍚箟鍚屾牱鐢辮皟鐢ㄨ呰嚜宸卞畾涔夈?/span><span lang="EN-US">start_routine</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪斿洖鏃訛紝榪欎釜綰跨▼灝遍鍑轟簡</span> <span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">銆?/span></p> <p style="margin: 0cm 0cm 0pt 18pt; mso-add-space: auto" class="MsoListParagraphCxSpMiddle"><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">娉ㄦ剰濡傛灉</span><span lang="EN-US">tidp</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏄叏灞鐨勫彉閲忥紝涓嶈鍦ㄥ瓙綰跨▼閲屼嬌鐢ㄥ畠錛屽洜涓哄彲鑳藉瓙綰跨▼榪愯鐨勬椂鍊欙紝涓葷嚎紼嬭繕娌℃湁鏉ュ緱鍙婄粰浠栬祴鍊箋傝繖涔熸槸紼嬪簭閲屾垜浠墦鍗板瓙綰跨▼</span><span lang="EN-US">ID</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐢ㄤ簡</span><span lang="EN-US">pthread_self</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鑰屾病鏈夌敤</span><span lang="EN-US">ntid</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨勫師鍥犮?/span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt; mso-add-space: auto; mso-list: l0 level1 lfo2" class="MsoListParagraphCxSpMiddle"><span style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin" lang="EN-US"><span style="mso-list: Ignore">2.<span style="font: 7pt 'Times New Roman'">       </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">濡傛灉</span> <span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍑芥暟鏈夎繑鍥炲鹼紝娉ㄦ剰瀵硅繑鍥炲肩殑鍒ゆ柇錛屼緥濡?/span><span lang="EN-US">create</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏃跺彲鑳借繑鍥?/span><span lang="EN-US">EAGAIN(</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">琛ㄧず綰跨▼鏁扮洰榪囧浜?/span><span lang="EN-US">)</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">錛?/span><span lang="EN-US">EINVAL(</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">琛ㄧず灞炴у奸潪娉?/span><span lang="EN-US">)</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">錛?/span><span lang="EN-US">join</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏃惰繑鍥?/span><span lang="EN-US">ESRCH(</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">琛ㄧず娌℃湁閭d釜綰跨▼錛屼緥濡傚凡緇?/span><span lang="EN-US">join</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪囦竴嬈′簡錛岀嚎紼嬭祫婧愯鏀跺洖錛岃繖涓嚎紼?/span><span lang="EN-US">id</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">涔熶竴璧瘋鍥炴敹錛屽氨浼氳繑鍥炶繖涓敊璇?/span><span lang="EN-US">)</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">絳夌瓑鍏朵粬銆傛劅瑙夊浠ュ悗瀛︿範綰跨▼灞炴ф槸姣旇緝鏈夌敤鐨勶紝鍥犱負寰堝閿欒浠庣嚎紼嬪睘鎬т笂鍙互浜嗚В鍘熷洜錛屽悓鏃跺姞娣卞綰跨▼灞炴х殑鐞嗚В銆傝繖浜涢敊璇兘鍙互閫氳繃</span><span lang="EN-US">man errno</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鏉ユ煡鐪嬨?/span></p> <p style="text-indent: -18pt; margin: 0cm 0cm 10pt 18pt; mso-add-space: auto; mso-list: l0 level1 lfo2" class="MsoListParagraphCxSpLast"><span style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin" lang="EN-US"><span style="mso-list: Ignore">3.<span style="font: 7pt 'Times New Roman'">       </span></span></span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">綰跨▼</span><span lang="EN-US">id</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鐨勭被鍨嬫槸</span><span lang="EN-US">pthread_t</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">錛屽畠鍙湪褰撳墠榪涚▼涓繚璇佹槸鍞竴鐨勶紝鍦ㄤ笉鍚岀殑緋葷粺涓?/span><span lang="EN-US">pthread_t</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪欎釜綾誨瀷鏈変笉鍚岀殑瀹炵幇錛屽畠鍙兘鏄竴涓暣鏁板鹼紝涔熷彲鑳芥槸涓粨鏋勪綋錛屽湴鍧絳夈備笉榪囨煡鐪?/span><span lang="EN-US">/usr/include/bits/pthreadtypes.h</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍙互鐪嬪埌鎴戠殑緋葷粺</span><span lang="EN-US">(ubuntu 10.04)</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">榪欓噷瀹氫箟涓?/span><span lang="EN-US">: typedef unsigned long int pthread_t.</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鍥犳紼嬪簭閲屾垜浠洿鎺ョ敤</span><span lang="EN-US">%x</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">鎵撳嵃鍏跺箋?/span></p> <p style="margin: 0cm 0cm 10pt" class="MsoNormal"><span lang="EN-US">ok</span><span style="font-family: 瀹嬩綋; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 瀹嬩綋; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">浜嗐傛帴涓嬫潵鍦ㄥ啓涓叧浜庣嚎紼嬬粓姝紝鍙栨秷浠ュ強鑾峰緱榪斿洖鐘舵佺殑渚嬪瓙銆?/span></p> <p align="left"> </p> <p style="margin: 0cm 0cm 0pt" class="Publishwithline"><strong><span style="font-size: 1.2em"><span style="color: #17365d"><span lang="EN-US"><span style="font-family: Calibri"></span></span></span></span></strong></p><img src ="http://m.shnenglu.com/izualzhy/aggbug/160022.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/izualzhy/" target="_blank">izualzhy</a> 2011-11-13 14:59 <a href="http://m.shnenglu.com/izualzhy/archive/2011/11/13/160022.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <a href="http://m.shnenglu.com/">青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品</a> <div style="position:fixed;left:-9000px;top:-9000px;"><font id="pjuwb"></font><button id="pjuwb"><pre id="pjuwb"></pre></button><sub id="pjuwb"></sub><tbody id="pjuwb"><var id="pjuwb"><address id="pjuwb"></address></var></tbody><listing id="pjuwb"><label id="pjuwb"><strong id="pjuwb"></strong></label></listing><wbr id="pjuwb"><small id="pjuwb"><tbody id="pjuwb"></tbody></small></wbr><ins id="pjuwb"><xmp id="pjuwb"></xmp></ins><style id="pjuwb"></style><label id="pjuwb"><em id="pjuwb"><li id="pjuwb"></li></em></label><samp id="pjuwb"></samp><menu id="pjuwb"><input id="pjuwb"></input></menu><pre id="pjuwb"><tbody id="pjuwb"><tfoot id="pjuwb"><button id="pjuwb"></button></tfoot></tbody></pre><form id="pjuwb"></form><i id="pjuwb"><style id="pjuwb"><label id="pjuwb"><sup id="pjuwb"></sup></label></style></i><li id="pjuwb"><table id="pjuwb"><abbr id="pjuwb"></abbr></table></li><video id="pjuwb"></video><dfn id="pjuwb"></dfn><progress id="pjuwb"></progress><strong id="pjuwb"></strong><mark id="pjuwb"></mark><em id="pjuwb"></em><tbody id="pjuwb"><p id="pjuwb"><strike id="pjuwb"><acronym id="pjuwb"></acronym></strike></p></tbody><option id="pjuwb"></option><strike id="pjuwb"></strike><u id="pjuwb"></u><td id="pjuwb"><center id="pjuwb"><tr id="pjuwb"></tr></center></td><em id="pjuwb"><mark id="pjuwb"><em id="pjuwb"><tt id="pjuwb"></tt></em></mark></em><strong id="pjuwb"></strong><wbr id="pjuwb"></wbr><s id="pjuwb"></s><strong id="pjuwb"></strong><legend id="pjuwb"></legend><nav id="pjuwb"></nav><dl id="pjuwb"><th id="pjuwb"><dl id="pjuwb"></dl></th></dl><noframes id="pjuwb"><ins id="pjuwb"></ins></noframes><font id="pjuwb"></font><strike id="pjuwb"><i id="pjuwb"><style id="pjuwb"><label id="pjuwb"></label></style></i></strike><output id="pjuwb"></output><thead id="pjuwb"><pre id="pjuwb"></pre></thead><source id="pjuwb"></source><menuitem id="pjuwb"><wbr id="pjuwb"></wbr></menuitem><pre id="pjuwb"><span id="pjuwb"><pre id="pjuwb"><big id="pjuwb"></big></pre></span></pre><cite id="pjuwb"><fieldset id="pjuwb"><s id="pjuwb"><rt id="pjuwb"></rt></s></fieldset></cite><big id="pjuwb"><progress id="pjuwb"><big id="pjuwb"></big></progress></big><samp id="pjuwb"><delect id="pjuwb"></delect></samp><dl id="pjuwb"></dl><strike id="pjuwb"><nav id="pjuwb"><dl id="pjuwb"><strong id="pjuwb"></strong></dl></nav></strike><tbody id="pjuwb"><b id="pjuwb"><optgroup id="pjuwb"><rp id="pjuwb"></rp></optgroup></b></tbody><em id="pjuwb"></em><xmp id="pjuwb"><blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote></xmp> <i id="pjuwb"><abbr id="pjuwb"><i id="pjuwb"><abbr id="pjuwb"></abbr></i></abbr></i><center id="pjuwb"><acronym id="pjuwb"><center id="pjuwb"></center></acronym></center><pre id="pjuwb"></pre><ul id="pjuwb"><thead id="pjuwb"></thead></ul><blockquote id="pjuwb"><pre id="pjuwb"><sup id="pjuwb"></sup></pre></blockquote><acronym id="pjuwb"></acronym><big id="pjuwb"><s id="pjuwb"></s></big><th id="pjuwb"></th><th id="pjuwb"></th><tbody id="pjuwb"></tbody><thead id="pjuwb"><strike id="pjuwb"></strike></thead><th id="pjuwb"><dl id="pjuwb"><wbr id="pjuwb"></wbr></dl></th><dl id="pjuwb"><strong id="pjuwb"></strong></dl><abbr id="pjuwb"><noframes id="pjuwb"><noscript id="pjuwb"></noscript></noframes></abbr><td id="pjuwb"><ol id="pjuwb"></ol></td><li id="pjuwb"><noscript id="pjuwb"><abbr id="pjuwb"></abbr></noscript></li><small id="pjuwb"><bdo id="pjuwb"><nav id="pjuwb"></nav></bdo></small><style id="pjuwb"></style><optgroup id="pjuwb"><table id="pjuwb"></table></optgroup><center id="pjuwb"><tr id="pjuwb"><dfn id="pjuwb"></dfn></tr></center><th id="pjuwb"></th><u id="pjuwb"></u><tfoot id="pjuwb"><legend id="pjuwb"><i id="pjuwb"></i></legend></tfoot><mark id="pjuwb"></mark><meter id="pjuwb"></meter><nav id="pjuwb"></nav><acronym id="pjuwb"><pre id="pjuwb"><acronym id="pjuwb"><ul id="pjuwb"></ul></acronym></pre></acronym><acronym id="pjuwb"><pre id="pjuwb"><acronym id="pjuwb"><ul id="pjuwb"></ul></acronym></pre></acronym><nobr id="pjuwb"></nobr><sub id="pjuwb"><th id="pjuwb"><menuitem id="pjuwb"><wbr id="pjuwb"></wbr></menuitem></th></sub><thead id="pjuwb"><sub id="pjuwb"></sub></thead><ul id="pjuwb"><address id="pjuwb"><menuitem id="pjuwb"><meter id="pjuwb"></meter></menuitem></address></ul><dfn id="pjuwb"></dfn><pre id="pjuwb"></pre><input id="pjuwb"><cite id="pjuwb"><fieldset id="pjuwb"></fieldset></cite></input><u id="pjuwb"><form id="pjuwb"><u id="pjuwb"></u></form></u><kbd id="pjuwb"><em id="pjuwb"><mark id="pjuwb"></mark></em></kbd><tr id="pjuwb"></tr><del id="pjuwb"><form id="pjuwb"><address id="pjuwb"></address></form></del><tfoot id="pjuwb"><legend id="pjuwb"><ol id="pjuwb"><dl id="pjuwb"></dl></ol></legend></tfoot><menu id="pjuwb"><nobr id="pjuwb"><th id="pjuwb"><nobr id="pjuwb"></nobr></th></nobr></menu><fieldset id="pjuwb"></fieldset><pre id="pjuwb"><blockquote id="pjuwb"><samp id="pjuwb"></samp></blockquote></pre><xmp id="pjuwb"><sup id="pjuwb"><pre id="pjuwb"></pre></sup></xmp><span id="pjuwb"><progress id="pjuwb"></progress></span><font id="pjuwb"></font><var id="pjuwb"><abbr id="pjuwb"></abbr></var><strong id="pjuwb"><label id="pjuwb"><i id="pjuwb"><legend id="pjuwb"></legend></i></label></strong><tr id="pjuwb"><em id="pjuwb"><em id="pjuwb"><output id="pjuwb"></output></em></em></tr><thead id="pjuwb"><strike id="pjuwb"></strike></thead> <acronym id="pjuwb"></acronym><i id="pjuwb"></i><tt id="pjuwb"></tt><rt id="pjuwb"><source id="pjuwb"><rt id="pjuwb"></rt></source></rt><strike id="pjuwb"><acronym id="pjuwb"></acronym></strike><del id="pjuwb"></del><font id="pjuwb"><output id="pjuwb"><ins id="pjuwb"><output id="pjuwb"></output></ins></output></font><kbd id="pjuwb"><tr id="pjuwb"><kbd id="pjuwb"></kbd></tr></kbd><pre id="pjuwb"><sup id="pjuwb"><delect id="pjuwb"><samp id="pjuwb"></samp></delect></sup></pre><samp id="pjuwb"></samp><track id="pjuwb"></track><tr id="pjuwb"></tr><center id="pjuwb"></center><fieldset id="pjuwb"></fieldset><i id="pjuwb"></i><td id="pjuwb"></td><rt id="pjuwb"></rt><object id="pjuwb"></object><pre id="pjuwb"><progress id="pjuwb"><sub id="pjuwb"><thead id="pjuwb"></thead></sub></progress></pre><kbd id="pjuwb"><tr id="pjuwb"><option id="pjuwb"></option></tr></kbd><output id="pjuwb"><ins id="pjuwb"></ins></output><ol id="pjuwb"></ol><source id="pjuwb"></source><strong id="pjuwb"></strong><ruby id="pjuwb"></ruby><sub id="pjuwb"><meter id="pjuwb"><menuitem id="pjuwb"><meter id="pjuwb"></meter></menuitem></meter></sub><pre id="pjuwb"></pre><center id="pjuwb"></center><tr id="pjuwb"><tbody id="pjuwb"><xmp id="pjuwb"><dd id="pjuwb"></dd></xmp></tbody></tr><video id="pjuwb"></video><pre id="pjuwb"></pre><form id="pjuwb"><optgroup id="pjuwb"></optgroup></form><samp id="pjuwb"></samp><kbd id="pjuwb"></kbd><strong id="pjuwb"><option id="pjuwb"></option></strong><object id="pjuwb"></object><abbr id="pjuwb"><noframes id="pjuwb"><abbr id="pjuwb"></abbr></noframes></abbr><ul id="pjuwb"><del id="pjuwb"><button id="pjuwb"><pre id="pjuwb"></pre></button></del></ul><abbr id="pjuwb"></abbr><strong id="pjuwb"><code id="pjuwb"><strong id="pjuwb"></strong></code></strong><option id="pjuwb"></option><optgroup id="pjuwb"><bdo id="pjuwb"><code id="pjuwb"></code></bdo></optgroup><mark id="pjuwb"><em id="pjuwb"><font id="pjuwb"></font></em></mark><acronym id="pjuwb"><code id="pjuwb"></code></acronym><dl id="pjuwb"></dl><em id="pjuwb"></em><object id="pjuwb"><input id="pjuwb"><object id="pjuwb"></object></input></object><output id="pjuwb"><dd id="pjuwb"></dd></output><option id="pjuwb"><button id="pjuwb"><option id="pjuwb"></option></button></option><small id="pjuwb"></small></div> <a href="http://derinsolar.com" target="_blank">国产精品爽爽ⅴa在线观看</a>| <a href="http://cibocentre.com" target="_blank">亚洲国产女人aaa毛片在线</a>| <a href="http://7628x.com" target="_blank">国产乱理伦片在线观看夜一区</a>| <a href="http://ccc982.com" target="_blank">免费在线国产精品</a>| <a href="http://cbb188.com" target="_blank">久久久人成影片一区二区三区</a>| <a href="http://eastasp.com" target="_blank">久久国产日韩</a>| <a href="http://by27333.com" target="_blank">免费在线看成人av</a>| <a href="http://xianconnector.com" target="_blank">欧美高清视频在线播放</a>| <a href="http://2323nn.com" target="_blank">欧美日韩美女</a>| <a href="http://wwwby113.com" target="_blank">国产精品夜夜夜</a>| <a href="http://2343ww.com" target="_blank">狠狠色2019综合网</a>| <a href="http://hy8r.com" target="_blank">亚洲乱码国产乱码精品精</a>| <a href="http://tigerpowerinc.com" target="_blank">亚洲精品在线一区二区</a>| <a href="http://www-tk8899.com" target="_blank">一区二区三区日韩精品视频</a>| <a href="http://www-222kkk.com" target="_blank">亚洲欧美自拍偷拍</a>| <a href="http://whrcjy.com" target="_blank">老巨人导航500精品</a>| <a href="http://www33779.com" target="_blank">亚洲精品国精品久久99热</a>| <a href="http://388123cc.com" target="_blank">亚洲综合激情</a>| <a href="http://789583.com" target="_blank">免费成人在线观看视频</a>| <a href="http://567acg.com" target="_blank">国产精品网站在线观看</a>| <a href="http://97sgg.com" target="_blank">91久久综合</a>| <a href="http://xashp.com" target="_blank">欧美影院视频</a>| <a href="http://nebnb89.com" target="_blank">亚洲精品免费在线观看</a>| <a href="http://jigu100.com" target="_blank">欧美在线视频a</a>| <a href="http://www789yys.com" target="_blank">欧美成人精品</a>| <a href="http://northboiler.com" target="_blank">国产欧美精品一区二区三区介绍</a>| <a href="http://caoliu20.com" target="_blank">在线日韩日本国产亚洲</a>| <a href="http://shnenglu.com" target="_blank">亚洲淫片在线视频</a>| <a href="http://6677ch.com" target="_blank">亚洲丁香婷深爱综合</a>| <a href="http://448968.com" target="_blank">午夜精品久久久久</a>| <a href="http://aqdit2022.com" target="_blank">欧美日韩爆操</a>| <a href="http://www224558.com" target="_blank">伊人夜夜躁av伊人久久</a>| <a href="http://32m8.com" target="_blank">午夜视黄欧洲亚洲</a>| <a href="http://tareandshare.com" target="_blank">欧美 日韩 国产一区二区在线视频 </a>| <a href="http://583775.com" target="_blank">老色鬼精品视频在线观看播放</a>| <a href="http://qqszdq.com" target="_blank">欧美国产大片</a>| <a href="http://zd-jm.com" target="_blank">亚洲欧美日韩国产综合精品二区</a>| <a href="http://yh5557.com" target="_blank">蜜桃av一区二区三区</a>| <a href="http://wwwhaodd116.com" target="_blank">国产美女精品人人做人人爽</a>| <a href="http://stt788.com" target="_blank">亚洲精品久久久久久一区二区</a>| <a href="http://xpj694.com" target="_blank">欧美亚洲网站</a>| <a href="http://666675com.com" target="_blank">99热这里只有精品8</a>| <a href="http://gbandal.com" target="_blank">欧美xart系列在线观看</a>| <a href="http://hzjqkj.com" target="_blank">一区国产精品</a>| <a href="http://viwasmart.com" target="_blank">久久国产欧美精品</a>| <a href="http://wwwby113.com" target="_blank">一区二区三区欧美日韩</a>| <a href="http://725806.com" target="_blank">欧美精品成人一区二区在线观看</a>| <a href="http://btbt7086.com" target="_blank">国产自产精品</a>| <a href="http://36seaa.com" target="_blank">久久精品二区三区</a>| <a href="http://www24668.com" target="_blank">亚洲制服欧美中文字幕中文字幕</a>| <a href="http://www456456.com" target="_blank">欧美精品日韩精品</a>| <a href="http://xhtd688.com" target="_blank">亚洲日本一区二区</a>| <a href="http://876769.com" target="_blank">欧美大片免费</a>| <a href="http://by71222.com" target="_blank">久久久欧美精品</a>| <a href="http://www18bbav.com" target="_blank">狠狠色狠狠色综合人人</a>| <a href="http://400206.com" target="_blank">久久久青草婷婷精品综合日韩</a>| <a href="http://788997.com" target="_blank">亚洲午夜久久久</a>| <a href="http://obatshaka.com" target="_blank">国产精品av免费在线观看</a>| <a href="http://gzhachi.com" target="_blank">在线午夜精品</a>| <a href="http://4123123.com" target="_blank">一区二区欧美日韩</a>| <a href="http://stt788.com" target="_blank">国产精品qvod</a>| <a href="http://778km.com" target="_blank">销魂美女一区二区三区视频在线</a>| <a href="http://xaipad.com" target="_blank">在线中文字幕一区</a>| <a href="http://wwwsenvpu.com" target="_blank">国产精品一区二区在线</a>| <a href="http://132653.com" target="_blank">欧美亚洲一级</a>| <a href="http://9113i.com" target="_blank">欧美诱惑福利视频</a>| <a href="http://7776701.com" target="_blank">国色天香一区二区</a>| <a href="http://www5566szy.com" target="_blank">蜜桃av噜噜一区</a>| <a href="http://www-44899.com" target="_blank">麻豆精品视频在线观看</a>| <a href="http://naturalgiftfashion.com" target="_blank">亚洲日本在线观看</a>| <a href="http://www9797abc.com" target="_blank">亚洲精品视频免费观看</a>| <a href="http://5917t.com" target="_blank">国产精品成人一区二区网站软件 </a>| <a href="http://www-55125.com" target="_blank">午夜欧美精品久久久久久久</a>| <a href="http://www47343.com" target="_blank">国产精品99久久99久久久二8</a>| <a href="http://cancerrxa.com" target="_blank">国产精品久久久久高潮</a>| <a href="http://329aaa.com" target="_blank">欧美一区二区免费</a>| <a href="http://8x27.com" target="_blank">欧美一级久久久</a>| <a href="http://heshundadi.com" target="_blank">亚洲成色www8888</a>| <a href="http://ffff53.com" target="_blank">亚洲人永久免费</a>| <a href="http://eee88888.com" target="_blank">国产精品久久中文</a>| <a href="http://739822.com" target="_blank">久久五月天婷婷</a>| <a href="http://yw-95588.com" target="_blank">亚洲视频999</a>| <a href="http://7234hh.com" target="_blank">欧美freesex8一10精品</a>| <a href="http://012488.com" target="_blank">最近看过的日韩成人</a>| <a href="http://www-273111.com" target="_blank">亚洲激情欧美激情</a>| <a href="http://51120guahao.com" target="_blank">欧美视频在线一区二区三区</a>| <a href="http://cp50088.com" target="_blank">久久爱另类一区二区小说</a>| <a href="http://k8m9.com" target="_blank">久久久无码精品亚洲日韩按摩</a>| <a href="http://www-919198.com" target="_blank">亚洲高清一二三区</a>| <a href="http://2343ww.com" target="_blank">一区二区三区免费在线观看</a>| <a href="http://zunguidq.com" target="_blank">国产婷婷色一区二区三区</a>| <a href="http://xingzhiyin85.com" target="_blank">欧美成人小视频</a>| <a href="http://zhxjl.com" target="_blank">国产精品久久婷婷六月丁香</a>| <a href="http://710195.com" target="_blank">欧美sm视频</a>| <a href="http://aqdw2021.com" target="_blank">国产精品国产福利国产秒拍</a>| <a href="http://qqszdq.com" target="_blank">老司机精品视频网站</a>| <a href="http://7269003.com" target="_blank">欧美日韩中文另类</a>| <a href="http://htzhuanli.com" target="_blank">快射av在线播放一区</a>| <a href="http://ym5571.com" target="_blank">欧美午夜免费电影</a>| <a href="http://497988.com" target="_blank">免费成人小视频</a>| <a href="http://2589999.com" target="_blank">国产精品毛片a∨一区二区三区|国 </a>| <a href="http://18av-77.com" target="_blank">一本大道久久精品懂色aⅴ</a>| <a href="http://iietao.com" target="_blank">亚洲在线不卡</a>| <a href="http://senlin86.com" target="_blank">亚洲激情一区二区三区</a>| <a href="http://4534com.com" target="_blank">亚洲欧美一区二区三区久久</a>| <a href="http://fdgkinetic.com" target="_blank">亚洲三级免费电影</a>| <a href="http://my6557.com" target="_blank">午夜亚洲福利在线老司机</a>| <a href="http://6399128.com" target="_blank">一本色道久久综合</a>| <a href="http://1235656.com" target="_blank">久热精品视频在线</a>| <a href="http://wwwavzz.com" target="_blank">久久久www成人免费精品</a>| <a href="http://quanfadq.com" target="_blank">欧美日本不卡</a>| <a href="http://cxjzcl.com" target="_blank">欧美成人日韩</a>| <a href="http://www18bbav.com" target="_blank">国产一区欧美</a>| <a href="http://402626com.com" target="_blank">一区二区三区 在线观看视频</a>| <a href="http://wwwzmcc1.com" target="_blank">在线不卡a资源高清</a>| <a href="http://603445.com" target="_blank">亚洲综合精品自拍</a>| <a href="http://avtb2068.com" target="_blank">亚洲一区二区免费看</a>| <a href="http://0370city.com" target="_blank">蜜臀久久99精品久久久久久9</a>| <a href="http://668527.com" target="_blank">欧美一区亚洲二区</a>| <a href="http://hgx123.com" target="_blank">国产精品高潮呻吟久久av无限</a>| <a href="http://5588207.com" target="_blank">亚洲大胆女人</a>| <a href="http://9911444.com" target="_blank">欧美成人午夜激情</a>| <a href="http://3dmh133.com" target="_blank">国产伦精品一区二区三区四区免费 </a>| <a href="http://xcao10.com" target="_blank">亚洲一区中文</a>| <a href="http://216667.com" target="_blank">亚洲色图制服丝袜</a>| <a href="http://555134.com" target="_blank">欧美国产精品久久</a>| <a href="http://com42923.com" target="_blank">免费在线日韩av</a>| <a href="http://www-ss777.com" target="_blank">国内自拍一区</a>| <a href="http://idc0558.com" target="_blank">久久成人精品</a>| <a href="http://www49718.com" target="_blank">久久婷婷成人综合色</a>| <a href="http://77xyc77.com" target="_blank">国产精品三区www17con</a>| <a href="http://9e67.com" target="_blank">一区二区三区成人</a>| <a href="http://sortxz.com" target="_blank">国产精品99久久久久久有的能看 </a>| <a href="http://www72227.com" target="_blank">99v久久综合狠狠综合久久</a>| <a href="http://770456.com" target="_blank">亚洲激情一区</a>| <a href="http://7213523.com" target="_blank">欧美激情综合在线</a>| <a href="http://rbet6365.com" target="_blank">亚洲国产精品成人va在线观看</a>| <a href="http://avhai.com" target="_blank">在线成人h网</a>| <a href="http://caox8.com" target="_blank">在线综合亚洲欧美在线视频</a>| <a href="http://zb557.com" target="_blank">一本色道88久久加勒比精品</a>| <a href="http://33wbwb.com" target="_blank">亚洲精美视频</a>| <a href="http://wwwcao88.com" target="_blank">蜜臀av性久久久久蜜臀aⅴ四虎</a>| <a href="http://y66776.com" target="_blank">久久久国产91</a>| <a href="http://64pppp.com " target="_blank">国产日产亚洲精品</a>| <a href="http://91porn42.com" target="_blank">亚洲欧美不卡</a>| <a href="http://njggmy.com" target="_blank">欧美一区二区观看视频</a>| <a href="http://youjizzbox.com" target="_blank">欧美日韩一卡</a>| <a href="http://226600b.com" target="_blank">中文成人激情娱乐网</a>| <a href="http://123yongjiu.com" target="_blank">亚洲午夜精品网</a>| <a href="http://233116.com" target="_blank">欧美精品九九</a>| <a href="http://188267.com" target="_blank">99re在线精品</a>| <a href="http://22127c.com" target="_blank">亚洲欧美日韩另类</a>| <a href="http://895658.com" target="_blank">国产精品自在欧美一区</a>| <a href="http://by33336.com" target="_blank">亚洲欧美另类国产</a>| <a href="http://icciran.com" target="_blank">欧美一级播放</a>| <a href="http://www-68689.com" target="_blank">国产日韩欧美一区在线</a>| <a href="http://lingshidu.com" target="_blank">亚洲欧美在线看</a>| <a href="http://fcponteggi.com" target="_blank">老鸭窝毛片一区二区三区 </a>| <a href="http://by274.com" target="_blank">亚洲欧美国产视频</a>| <a href="http://free18teen.com" target="_blank">国产日韩欧美在线看</a>| <a href="http://3315588.com" target="_blank">久久久国产视频91</a>| <a href="http://xigou666.com" target="_blank">亚洲国产高清自拍</a>| <a href="http://www01614.com" target="_blank">中国女人久久久</a>| <a href="http://5s5s5s.com" target="_blank">国内精品久久久久久影视8</a>| <a href="http://www-44899.com" target="_blank">久久一区中文字幕</a>| <a href="http://215920.com" target="_blank">99热在线精品观看</a>| <a href="http://jiuzuifusheng.com" target="_blank">久久久国产精品一区二区三区</a>| <a href="http://www-333304.com" target="_blank">亚洲高清不卡在线</a>| <a href="http://fsdashen.com" target="_blank">欧美日韩在线视频一区二区</a>| <a href="http://ncyy4.com" target="_blank">久久成人人人人精品欧</a>| <a href="http://www17727.com" target="_blank">亚洲第一视频</a>| <a href="http://yytaotu.com" target="_blank">欧美一区在线看</a>| <a href="http://057232.com" target="_blank">亚洲精品一区二区三区樱花</a>| <a href="http://maoshimh.com" target="_blank">欧美系列亚洲系列</a>| <a href="http://tingxihuan.com" target="_blank">久久亚洲高清</a>| <a href="http://842332.com" target="_blank">亚洲视屏在线播放</a>| <a href="http://5cok.com" target="_blank">欧美黄色大片网站</a>| <a href="http://mkaqiu.com" target="_blank">久久国产精品久久久久久久久久 </a>| <a href="http://amiee88.com" target="_blank">蜜臀av一级做a爰片久久</a>| <a href="http://cxjzcl.com" target="_blank">一本大道久久a久久精品综合</a>| <a href="http://www520590.com" target="_blank">国产午夜精品在线观看</a>| <a href="http://www524141.com" target="_blank">欧美理论在线</a>| <a href="http://y3u7.com" target="_blank">久久综合五月</a>| <a href="http://ahhyez.com" target="_blank">欧美一区二区三区在线</a>| <a href="http://bgflee.com" target="_blank">亚洲精品中文字幕在线</a>| <a href="http://tzhsdy.com" target="_blank">久久综合中文色婷婷</a>| <a href="http://bjjxgcsxy.com" target="_blank">亚洲欧美文学</a>| <a href="http://nmbgbc.com" target="_blank">中文国产成人精品久久一</a>| <a href="http://3374com.com" target="_blank">激情偷拍久久</a>| <a href="http://qqkanp.com" target="_blank">国产欧美亚洲精品</a>| <a href="http://xing69.com" target="_blank">欧美性生交xxxxx久久久</a>| <a href="http://avtt59999.com" target="_blank">美女图片一区二区</a>| <a href="http://srojsy.com" target="_blank">亚洲欧美精品伊人久久</a>| <a href="http://hy8r.com" target="_blank">日韩视频永久免费</a>| <a href="http://033232.com" target="_blank">亚洲国产精品久久精品怡红院</a>| <a href="http://eee104.com" target="_blank">久久国产精品一区二区三区</a>| <a href="http://080973.com" target="_blank">亚洲一区影音先锋</a>| <a href="http://842332.com" target="_blank">一区二区三区免费看</a>| <a href="http://687989.com" target="_blank">亚洲日本乱码在线观看</a>| <a href="http://cloakok.com" target="_blank">一区二区视频免费在线观看</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>