FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour multi-threaded under xHarbour
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
multi-threaded under xHarbour
Posted: Thu Feb 25, 2016 10:36 AM

Work under xHarbour functions are multi-threaded such as StartThread() / StopThread() ?

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: multi-threaded under xHarbour
Posted: Thu Feb 25, 2016 05:29 PM

xHarbour seems to support multithread. What do you want to know exactly?

EMG

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: multi-threaded under xHarbour
Posted: Thu Feb 25, 2016 07:49 PM

Want to learn how you can create a new thread (with the function StartThread() failed)

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: multi-threaded under xHarbour
Posted: Thu Feb 25, 2016 08:39 PM

Do you get any error messages?

EMG

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: multi-threaded under xHarbour
Posted: Thu Feb 25, 2016 09:26 PM

I don't get errors, just nothing happens.
I tried to run the examples with StartThread(), but instead of thread handle this function returns empty.
for example:

PROCEDURE Main
LOCAL pThread

  CLS
  USE Customer
  pThread := StartThread( "ShowTime", 0, MaxCol()-7 )

  Browse()

  StopThread( pThread )

  WaitForThreads()

RETURN

PROCEDURE ShowTime( nRow, nCol )
DO WHILE .T.
DispOutAt( nRow, nCol, Time() )
ThreadSleep( 1000 )
ENDDO
RETURN

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: multi-threaded under xHarbour
Posted: Fri Feb 26, 2016 09:54 AM

Just tried: works fine here.

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: multi-threaded under xHarbour
Posted: Fri Feb 26, 2016 11:39 AM

Some details:

  • I'm using latest xHarbour from SVN and BCC 7.10
  • I had to link cw32mt.lib and vmmt.lib

EMG

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: multi-threaded under xHarbour
Posted: Fri Feb 26, 2016 12:07 PM

Hm.. similarly, but does not work. I will think

Enrico, thank for your help !

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: multi-threaded under xHarbour
Posted: Fri Feb 26, 2016 12:29 PM
Please try adding

Code (fw): Select all Collapse
SETMODE( 25, 80 )


at the start of your sample.

EMG
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: multi-threaded under xHarbour
Posted: Sun Feb 28, 2016 07:54 PM

I create a thread th:=Startthread() and open DIALOG . After doing the main thread I close my thead StopThread(th) or KillThread(th). But apparently the DIALOG in the thread is not closed and when you try to create a thread I get the error WINDOWS

Continue the discussion