use hb_threadStart() in a CLASS ?

use hb_threadStart() in a CLASS ?

Postby Jimmy » Sat Feb 25, 2023 10:01 am

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 :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1595
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: use hb_threadStart() in a CLASS ?

Postby cnavarro » Sat Feb 25, 2023 3:01 pm

Try
Code: Select all  Expand view

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
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: use hb_threadStart() in a CLASS ?

Postby Jimmy » Sun Feb 26, 2023 5: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: Select all  Expand view
hbmk2 XXX -mt

but how when use *.MAK (BCC) or *.HBP (MSVC) :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1595
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests