Multi-Thread

HMG en Español

Moderator: Rathinagiri

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Multi-Thread

Post by fchirico »

1) Perdón mi ignorancia, que es Multi-Thread?
2) Por ejemplo cuando compilo con HMG 3 con /mt, qué significa?

Gracias y saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Multi-Thread

Post by esgici »

fchirico wrote:1) Perdón mi ignorancia, que es Multi-Thread?
2) Por ejemplo cuando compilo con HMG 3 con /mt, qué significa?
Google Translate wrote:Pardon my ignorance, which is multi-threaded?
2) For example when I compile with HMG 3 with / mt, does that mean?
Hola Fernando

Please look at here, or preferably here.

This will give you an idea.

Saludos

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Multi-Thread

Post by fchirico »

esgici wrote: Hola Fernando

Please look at here, or preferably here.

This will give you an idea.

Saludos

--

Esgici
Thank You Esgici!

Then it should always compile with the parameter "/ mt"?

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Multi-Thread

Post by esgici »

Hola Fernando
fchirico wrote: ...
Then it should always compile with the parameter "/ mt"?
...
Sorry, I haven't any experience, only wiki info :(

IMHO, until learned properly we should always compile withOUT the parameter "/mt"

Saludos

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Multi-Thread

Post by fchirico »

esgici wrote:Hola Fernando
fchirico wrote: ...
Then it should always compile with the parameter "/ mt"?
...
Sorry, I haven't any experience, only wiki info :(

IMHO, until learned properly we should always compile withOUT the parameter "/mt"

Saludos

--

Esgici
Yes, you are right.

Than you!

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Multi-Thread

Post by Roberto Lopez »

fchirico wrote:
esgici wrote:Hola Fernando
fchirico wrote: ...
Then it should always compile with the parameter "/ mt"?
...
Sorry, I haven't any experience, only wiki info :(

IMHO, until learned properly we should always compile withOUT the parameter "/mt"

Saludos

--

Esgici
Yes, you are right.

Than you!

Saludos, Fernando Chirico.
From today's Harbour developers list:
Asunto:
Re: [Harbour] Multithreading support in Harbour
De:
Przemys?aw Czerpak <druzus@acn.waw.pl>
Fecha:
Wed, 4 Nov 2009 13:08:33 +0100
Para:
"Harbour Project Main Developer List." <harbour@harbour-project.org>

On Wed, 04 Nov 2009, Enrico Maria Giordano wrote:
> > Dear friends, I'd like to know where to find informations about the
> > current state of the Harbour support for multithreading and if it's
> > stable enough to be used in the applications.
> > Many thanks in advance.

Look at:
doc/xhb-diff.txt: "MULTI THREAD SUPPORT"

In Harbour MT mode is fully functional and AFAIK is production ready
without any known bugs except 4 document problems which has not been
addressed and maybe never will be because they are not strictly
necessary to create final applications:
1. Tracelog is not MT safe. It's not a big problem for normal
applications because this code is disabled in standard builds and
enabled only on explicit user request during Harbour compilation
to debug some Harbour internals so it's rather for developers only.
2. PROFILLER cannot collect information for each thread separately.
It's optional code disabled by default. Before we will touch it
please think how it should work for MT programs.
3. DEBUGGER: only main thread debugger can see the names of file wide
STATICs and have information about line numbers with good break
points. We should add code to share this information between threads.
4. hb_threadQuitRequest() can be ignored by thread in some cases
due to race condition. It may happen if thread will overwrite
request send by caller simultaneously, f.e. by its own BREAK.
I can resolve it but we can also leave it as is and document
such behavior as expected or even remove this function. Killing
other threads in such way is dangerous and can be used only
for some simple situation. It's much safer when user uses his
own mechanism to terminate treads in some safe for his code places.


Harbour PRG level API:

hb_threadStart( [<nThreadAttrs> ,] <@sStart()> | <bStart> | <cStart> [, <params,...> ] ) -> <pThID>
hb_threadSelf() -> <pThID> | NIL
hb_threadId( [ <pThID> ] ) -> <nThNo>
hb_threadJoin( <pThID> [, @<xRetCode> ] ) -> <lOK>
hb_threadDetach( <pThID> ) -> <lOK>
* hb_threadQuitRequest( <pThID> ) -> <lOK>
hb_threadTerminateAll() -> NIL
hb_threadWaitForAll() -> NIL
hb_threadWait( <pThID> | <apThID>, [ <nTimeOut> ] [, <lAll> ] ) => <nThInd> | <nThCount> | 0
hb_threadOnce( @<onceControl> [, <bAction> ] ) -> <lFirstCall>
hb_mutexCreate() -> <pMtx>
hb_mutexLock( <pMtx> [, <nTimeOut> ] ) -> <lLocked>
hb_mutexUnlock( <pMtx> ) -> <lOK>
hb_mutexNotify( <pMtx> [, <xVal>] ) -> NIL
hb_mutexNotifyAll( <pMtx> [, <xVal>] ) -> NIL
hb_mutexSubscribe( <pMtx>, [ <nTimeOut> ] [, @<xSubscribed> ] ) -> <lSubscribed>
hb_mutexSubscribeNow( <pMtx>, [ <nTimeOut> ] [, @<xSubscribed> ] ) -> <lSubscribed>

* - this function call can be ignored by the destination thread in some
cases. HVM does not guaranties that the QUIT signal will be always
delivered.

xBase++ compatible functions and classes:
ThreadID() -> <nID>
ThreadObject() -> <oThread>
ThreadWait( <aThreads>, <nTimeOut> ) -> <xResult>
ThreadWaitAll( <aThreads>, <nTimeOut> ) -> <lAllJoind>

Thread() -> <oThread> // create thread object
Signal() -> <oSignal> // create signal object

Harbour supports also SYNC methods and SYNC class method implementing
original xBase++ behavior.

It also supports xBase++ concept of moving workareas between threads
using functions like dbRelease() and dbRequest().

In tests/mt you will find few simple test programs for MT mode.
Some of Harbour tools like hbmk2 or uhttpd[2] (examples/httpsrv,
/examples/uhttpd2) use extensively MT mode.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailma ... fo/harbour
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5481
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Multi-Thread

Post by Rathinagiri »

Thanks for throwing some light on the subject Roberto.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Multi-Thread

Post by fchirico »

Roberto Lopez wrote: From today's Harbour developers list:
.....
Gracias Roberto!

Disculpame pero me surgen dos dudas:

1) el IDE compila por defecto con /mt ?

2) si no es así, cómo debo indicarle que compile con /mt?

3) y si es así, cómo debo indicarle que no compile con /mt?


Nuevamente gracias y disculpame.

saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Re: Multi-Thread

Post by fchirico »

fchirico wrote:
Roberto Lopez wrote: From today's Harbour developers list:
.....
Gracias Roberto!

Disculpame pero me surgen dos dudas:

1) el IDE compila por defecto con /mt ?

2) si no es así, cómo debo indicarle que compile con /mt?

3) y si es así, cómo debo indicarle que no compile con /mt?


Nuevamente gracias y disculpame.

saludos, Fernando Chirico.
Gracias Roberto, ya me di cuenta donde cambiar todo esto del parámetro /mt desde el IDE o directamente editando el archivo .hbc.

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Multi-Thread

Post by Roberto Lopez »

fchirico wrote:
Roberto Lopez wrote: From today's Harbour developers list:
.....
Gracias Roberto!

Disculpame pero me surgen dos dudas:

1) el IDE compila por defecto con /mt ?

2) si no es así, cómo debo indicarle que compile con /mt?

3) y si es así, cómo debo indicarle que no compile con /mt?


Nuevamente gracias y disculpame.

saludos, Fernando Chirico.
IDE does not build with /mt by default. To enable you must double click the appropriate line in configuration tab.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply