clean-up "ready" Thread from Array

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

clean-up "ready" Thread from Array

Post by AUGE_OHR »

hi,

i use Thread for ShFile API Function (copy,move etc)

Code: Select all

FUNCTION DoSHfunc( cAction, lConfirm, lPaperbin )
      AADD( aSHThread, {} )
      nLen := LEN( aSHThread )
      aSHThread[ nLen ] := hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @DoSH2func(), cAction, lConfirm, lPaperbin )
      AttachThreadInput( nMainThreadID, HMG_ThreadHBtoWinID( aSHThread[ nLen ] ), .T. )
when end App i clean-up

Code: Select all

FUNCTION CloseThread()
   FOR i := 1 TO LEN( aShThread )
      IF aShThread[ i ] <> NIL
         hb_threadDetach( aShThread[ i ] )
         hb_threadQuitRequest( aShThread[ i ] )
         aShThread[ i ] := NIL
now i like to ask for a Way to clean-up when Thread is "ready" so i search for something like IsThreadActive(nThread) :idea:
have fun
Jimmy
Post Reply