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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用setjump loopjump在線程中跳轉(zhuǎn)的問題

使用setjump loopjump在線程中跳轉(zhuǎn)的問題

慕虎7371278 2019-07-06 23:08:52
使用setjumploopjump在線程中跳轉(zhuǎn)的問題使用setjump到另一個線程中跳轉(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 回答

?
一只萌萌小番薯

TA貢獻(xiàn)1795條經(jīng)驗(yàn) 獲得超7個贊

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

TA貢獻(xiàn)2036條經(jīng)驗(yàn) 獲得超8個贊

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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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