Page 1 of 1

use hb_threadStart() in a CLASS ?

PostPosted: Sat Feb 25, 2023 10:01 am
by Jimmy
hi,

to "fill" Imagelist i want to use a Thread to call a Method of CLASS

Code: Select all  Expand view
  AADD(::aThread, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @::ImageThread() ))

or
Code: Select all  Expand view
LOCAL oSelf := SELF
   AADD(::aThread, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @oSelf:ImageThread() ))

but that Syntax does not work :(

so i change to
Code: Select all  Expand view
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 :?:

Re: use hb_threadStart() in a CLASS ?

PostPosted: Sat Feb 25, 2023 3:01 pm
by cnavarro
Try
Code: Select all  Expand view

LOCAL oSelf := Self

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

Re: use hb_threadStart() in a CLASS ?

PostPosted: Sun Feb 26, 2023 5:00 am
by Jimmy
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: Select all  Expand view
hbmk2 XXX -mt

but how when use *.MAK (BCC) or *.HBP (MSVC) :?: