FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour use hb_threadStart() in a CLASS ?
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
use hb_threadStart() in a CLASS ?
Posted: Sat Feb 25, 2023 10:01 AM
hi,

to "fill" Imagelist i want to use a Thread to call a Method of CLASS
Code (fw): Select all Collapse
   AADD(::aThread, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @::ImageThread() ))
or
Code (fw): Select all Collapse
LOCAL oSelf := SELF
   AADD(::aThread, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @oSelf:ImageThread() ))
but that Syntax does not work :(

so i change to
Code (fw): Select all Collapse
LOCAL oSelf := SELF
   AADD(::aThread, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @TransFunc(), oSelf ))

FUNCTION TransFunc(oSelf)
fwlog "TransFunc Start"+TIME(), oSelf
   oSelf:ImageThread()
   oSelf:RefreshAll()
fwlog "TransFunc Stop"+TIME()
RETURN .T.
but i do not get Log-file :shock:
seems as Thread was not start .... hm

what i´m doing wrong :?:
greeting,

Jimmy
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: use hb_threadStart() in a CLASS ?
Posted: Sat Feb 25, 2023 03:01 PM
Try
Code (fw): Select all Collapse
LOCAL oSelf := Self

   AADD(::aThread, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, { || oSelf:&("ImageThread")() } ))
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: use hb_threadStart() in a CLASS ?
Posted: Sun Feb 26, 2023 05:00 AM
hi,

the Problem is not the Syntax. it seems Fivewin is not use -mt default
but as i understand it need "multi-Threading" else Thread does not work

i have search in Fivewin for hb_threadStart()

there is a Sample c:\fwh\samples\testmt02.prg
when press "Test" hb_threadStart() does NOT WORK and show NO MsgWait() or new Dialog :(

it seems me that Fivewin User does not know hb_threadStart()

---

when have a lot to PRINT you can not work on "other" ... right :?:
NO, you can use hb_threadStart() and PRINT in "other" Thread

---

it seems to work when call
Code (fw): Select all Collapse
hbmk2 XXX -mt
but how when use *.MAK (BCC) or *.HBP (MSVC) :?:
greeting,

Jimmy

Continue the discussion