Enrico Maria Giordano wrote:No, other apps don't stop. Maybe I can use threads but I'm not familiar with them.
EMG
mt should work fine except for some GUI components (modal dialog boxes)
Antonio Linares wrote:Patrizio,
Have you tried to use mt with FiveWin ?
mt should work fine except for some GUI components (modal dialog boxes)
Once there is a good support for threads in Harbour/xHarbour, then we will be able to adapt FWH to multithreading.
#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
HB_MUTEXCREATE
STARTTHREAD
WAITFORTHREADS
MUTEXLOCK
GETTHREADID
GETSYSTEMTHREADID
MUTEXUNLOCK
STARTTHREAD
WAITFORTHREADS
GETTHREADID
GETSYSTEMTHREADID
anserkk wrote:Dear Mr.Patrizio,
Thanks for the sample. Which xHarbour lib is to be added. I am getting unresolved external
HB_MUTEXCREATE
STARTTHREAD
WAITFORTHREADS
MUTEXLOCK
GETTHREADID
GETSYSTEMTHREADID
MUTEXUNLOCK
anserkk wrote:Hi,
xHarbour VmMt.Lib contains all the missing MultiThread related functions
- Code: Select all Expand view RUN
HB_MUTEXCREATE
STARTTHREAD
WAITFORTHREADS
MUTEXLOCK
GETTHREADID
GETSYSTEMTHREADID
MUTEXUNLOCK
Unfortunately when I compile, I am still getting Unresolved Externals calls from VmMt.Lib to the following functions
__endthreadex
__beginthreadex
Regards
Anser
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 59 guests