第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

使用setjump loopjump在線程中跳轉(zhuǎn)的問(wèn)題跪求!

使用setjump loopjump在線程中跳轉(zhuǎn)的問(wèn)題跪求!

qq_笑_17 2019-07-26 23:32:39
使用setjumploopjump在線程中跳轉(zhuǎn)的問(wèn)題使用setjump到另一個(gè)線程中跳轉(zhuǎn),跳轉(zhuǎn)成功了,后面的代碼不執(zhí)行了#define_CRT_SECURE_NO_WARNINGS#include#include#include#include#include#include#includejmp_bufbuf;void*print_a(void*);void*print_b(void*);//線程A方法void*print_a(void*a){for(inti=0;i
查看完整描述

2 回答

?
江戶(hù)川亂折騰

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超5個(gè)贊

講真,我沒(méi)想到還能這么用....
setjmp/longjmpisimplementedbysavingtheregister(includingstackandcodepointeretc)whenfirstpassed,andrestoringthemjumping.
當(dāng)線程b通過(guò)longjmp跳到print_a時(shí),它的棧幀和線程a的棧幀所在的內(nèi)存就是一個(gè)地方了(原來(lái)?xiàng)5膬?nèi)存沒(méi)人管)。當(dāng)線程a退出時(shí),自然要彈出所有棧幀,那么線程b之后對(duì)棧訪問(wèn)就是對(duì)非法內(nèi)存的訪問(wèn)了。
就像你把雙胞胎中的弟弟的頭嫁接到哥哥身上,哥哥變成了連體嬰兒,哥哥掛掉之后,弟弟也活不成了,反之也是
                            
查看完整回答
反對(duì) 回復(fù) 2019-07-26
?
子衿沉夜

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個(gè)贊

longjmp不能跨線程。
C117.13.2.1/2:
Thelongjmpfunctionrestorestheenvironmentsavedbythemostrecentinvocationofthesetjmpmacrointhesameinvocationoftheprogramwiththecorrespondingjmp_bufargument.Iftherehasbeennosuchinvocation,oriftheinvocationwasfromanotherthreadofexecution,orifthefunctioncontainingtheinvocationofthesetjmpmacrohasterminatedexecutionintheinterim,oriftheinvocationofthesetjmpmacrowaswithinthescopeofanidentifierwithvariablymodifiedtypeandexecutionhasleftthatscopeintheinterim,thebehaviorisundefined
                            
查看完整回答
反對(duì) 回復(fù) 2019-07-26
  • 2 回答
  • 0 關(guān)注
  • 487 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)