On Wed, 03 Feb 2010, Lorenzo Fiorini wrote: > > You are freeing directly or indirectly HRB module which is currently > > executed. HRB modules are unloaded automatically when all references to > > pHRB variable returned by hb_hrbLoad() are cleared. > > Fix you code to keep HRB module alive as long as it is used. > Here is the code that run the hrb [...] > hb_threadDetach( hb_threadStart( @processcall(), Self, nSocket ) ) [...] > function processcall( oServer, nSocket ) > if !empty( pHRB := hb_hrbload( cBinFile ) ) > xResult := hrbmain() [...]
I guess you loading public function hrbmain() from different threads simultaneously without any protection. Only _one_ public function with the same name can exist. You do not have any protection so it's possible that: xResult := hrbmain() begins to execute HRB code loaded by other thread and before it finish the other threads unloads the HRB module. Look at hbhrb.ch and <nOptions> in: HB_HRBLOAD( [ <nOptions>, ] <cHrb> [, <xparams,...> ] ) -> <pHrb> and read related ChangeLog entires, i.e.: 2009-06-19 18:38 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) 2009-06-19 14:09 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) or simply migrate to static functions only. You can use HB_HRBGETFUNSYM( <pHRB>, <cFuncName> ) -> <sFuncSym> to extract function symbol from HRB module, i.e.: if !empty( sFunc := hb_hrbGetFunSym( pHRB, "HRBMAIN" ) ) xResult := sFunc:exec() endif HB_HRB_BIND_FORCELOCAL converts automatically all functions to static ones when HBR module is loaded. > always > if !empty( pHRB ) > hb_hrbunload( pHRB ) > endif This is not necessary for current code so you can remove these lines. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour