FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour threads timeout
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
threads timeout
Posted: Tue Feb 18, 2020 06:29 AM
live demo:
https://fivetechsoft.github.io/snippets?20200218110744

Code (fw): Select all Collapse
function Main()

   local pThread
   
   pThread =  hb_threadStart( @Test() )

   if hb_threadWait( pThread, 5 ) != 1   // We wait 5 seconds
      hb_threadQuitRequest( pThread )
   endif

   hb_threadWaitForAll()

   ? "ok"

return nil

function Test()

   ErrorBlock( { | oError | AP_RPuts( "errorblock" ), Break( oError ) } )

   ? hb_Compiler()
   
   while .T.    // endless loop to block the thread
   end
   
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion