Harbour + MultiThread

Harbour + MultiThread

Postby vilian » Mon Sep 02, 2013 8:09 pm

Hi,

I already run my function in a thread using:

hb_threadStart( @VerificaVersoes(),oEmpresa )

But when I close the program, always generates the error message below, Even having been completed the process carried out by VerificaVersoes()

Image
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Harbour + MultiThread

Postby vilian » Tue Sep 03, 2013 1:10 pm

I got a code posted in this forum to test Threads,

Code: Select all  Expand view
#include "Fivewin.ch"

 PROC Main()
    LOCAL aObj  := Array(1000000)
    LOCAL oDlg, oButton
    PUBLIC nDestroyed := 0
    DEFINE DIALOG oDlg SIZE 400, 500
    @ 11,  0 BUTTON    oButton     PROMPT "Start"    SIZE 80,  8 ACTION Button1_Click(oDlg)
    ACTIVATE DIALOG oDlg CENTER
 RETURN

 PROC Button1_Click(oDlg)
    LOCAL n        := 0
    LOCAL pMutex   := HB_MutexCreate()
    FOR n :=1 TO 10
       StartThread( "MyFuncForThreads", pMutex, oDlg, n )
    NEXT
    WaitForThreads()
 RETURN

 PROC MyFuncForThreads(pMutex,oDlg,n)
    LOCAL cTID
    HB_MutexLock(pMutex)
    oDlg:Say(n,0,"Thread ID" + lTrim(Str(GetThreadID())) + " system id: " + lTrim(Str(GetSystemThreadID())))
    HB_MutexUnlock(pMutex)
 RETURN


and even there the situation repeats itself. The program works perfectly, but when I close it the following message appears:

Image

Can anyone help me?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Harbour + MultiThread

Postby vilian » Wed Sep 04, 2013 1:20 pm

+1
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Harbour + MultiThread

Postby vilian » Thu Sep 05, 2013 10:51 am

+1
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Harbour + MultiThread

Postby vilian » Mon Sep 09, 2013 11:04 am

`+1
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Harbour + MultiThread

Postby Antonio Linares » Mon Sep 09, 2013 1:12 pm

Vilian,

Your example is working fine here using FWH 13.07 and Harbour. I have used buildh.bat to build it simply changing:

echo %hdirl%\hbvmmt.lib + >> b32.bc

and

echo %bcdir%\lib\cw32mt.lib + >> b32.bc

I can provide you the EXE in case you want to run it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41439
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests