Pessoal,
Com hb_ThreadStart eu inicio uma Thread. Mas como mato uma ThRead sem que seja preciso sair do sistema?
Janio
Moderador: Moderadores
CREATE CLASS RunWhileThreadClass
VAR lExit INIT .F.
VAR nThreadId
VAR nInterval INIT 600
VAR cWindowTitle INIT ""
VAR bCode
METHOD New() INLINE ::nThreadId := hb_ThreadSelf(), SELF
METHOD Execute( bCode )
ENDCLASS
METHOD Execute( bCode ) CLASS RunWhileThreadClass
LOCAL nCont
hb_gtReload( hb_gtInfo( HB_GTI_VERSION ) )
IF bCode != NIL
::bCode := bCode
ENDIF
AppInitSets()
HB_GtInfo( HB_GTI_WINTITLE, ::cWindowTitle )
wvgSetAppWindow():Hide()
DO WHILE ! ::lExit
Eval( ::bCode )
FOR nCont = 1 TO ::nInterval
hb_ReleaseCPU()
IF hb_ThreadWait( ::nThreadId, 0.1, .T. ) == 1
::lExit := .T.
ENDIF
Inkey(1)
IF ::lExit
EXIT
ENDIF
NEXT
ENDDO
RETURN NIL
oProcesso := RunWhileThreadClass():New()
oProcesso:bCode := { || executar() }
hb_ThreadStart( oProcesso:Executer() )
fladimir escreveu:hb_threadTerminateAll() //------------> Funciona porém além de matar a thread q quero mata outras q não queroouKillThread(ThRead) //-----------> Da erro como se a função não existisse.
hbmk2 -find thread
hbxpp.hbc (instalado):
Thread()
ThreadID()
ThreadObject()
ThreadWait()
ThreadWaitAll()
hbpgsql.hbc (não instalado):
PQisthreadsafe()
hbsqlit3.hbc (instalado):
sqlite3_threadsafe()
hbwin.hbc (instalado):
wapi_GetCurrentThread()
wapi_GetCurrentThreadId()
rddads.hbc (não instalado):
AdsMgGetWorkerThreadActivity()
xhb.hbc (instalado):
GetCurrentThread()
GetSystemThreadId()
GetThreadId()
hb_MultiThread()
IsSameThread()
IsValidThread()
JoinThread()
KillAllThreads()
KillThread()
StartThread()
StopThread()
ThreadGetCurrent()
ThreadGetCurrentInternal()
ThreadSleep()
WaitForThreads()
Núcleo Harbour (instalado):
hb_threadDetach()
hb_threadID()
hb_threadIsMain()
hb_threadJoin()
hb_threadOnce()
hb_threadOnceInit()
hb_threadQuitRequest()
hb_threadSelf()
hb_threadStart()
hb_threadTerminateAll()
hb_threadWait()
hb_threadWaitForAll()
__vmCountThreads()
josequintas.hbc (não instalado):
appismultithread()
changemultithread()
Usuários vendo este fórum: Google [Bot] e 8 visitantes