好久沒研究PB,因為以前專案需要所以最近搞一下多執行緒,寫了一個簡單的demo測驗一下,但是報錯了,不太理解,不知道是不是自己哪里理解錯了,求大神們指教
@WorldMobile @路人甲cw
SharedObjectRegister("uo_thread","ExpThreadInstance")
SharedObjectGet("ExpThreadInstance",thread_one)
thread_one.uf_setparent(parent)
thread_one.post uf_event( )
報錯如圖,

對應uo_thread類代碼如下,是nonvisualobject
forward
global type uo_thread from nonvisualobject
end type
end forward
global type uo_thread from nonvisualobject
end type
global uo_thread uo_thread
type variables
window w_agu
end variables
forward prototypes
public subroutine uf_setparent (window w_get)
public subroutine uf_event ()
end prototypes
public subroutine uf_setparent (window w_get);w_agu = w_get
end subroutine
public subroutine uf_event ();w_agu.triggerevent("ue_event")
end subroutine
on uo_thread.create
call super::create
TriggerEvent( this, "constructor" )
end on
on uo_thread.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
一直無法實作多執行緒效果,求大神指教,或者給我個思路,能寫個簡單的demo更好了
uj5u.com熱心網友回復:
多執行緒在PB下問題不少,如果編譯為PBD還可以將就著用,編譯為單獨的 exe,程式退出來,還沒有真的退出,要等好一會,系統才會去回收退出的程式uj5u.com熱心網友回復:
編譯成PBD或者dll都可以,關鍵是現在我連多執行緒的簡單demo都沒搞定
uj5u.com熱心網友回復:
來個大神幫幫忙啊
uj5u.com熱心網友回復:
哎……,真的是沒人了嗎
uj5u.com熱心網友回復:
我也想知道怎么能實作,幫你頂下
uj5u.com熱心網友回復:
網上一搜一大把uj5u.com熱心網友回復:
感覺PB的timer事件也蠻好用的。uj5u.com熱心網友回復:
timer好用也代替不了執行緒啊
uj5u.com熱心網友回復:
就是在網上搜的帖子或者博文實作不了,才想求組的大神
不過最近在學習路大神的pfw,看pfw里的代理執行緒類別庫是如何實作的
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/21345.html
標籤:基礎類
