Hi All,
Please help me create a function that will try to implement the Xbase++-style multi-threading design right at the "Main Menu" option/s. For example, we have this function in one of Xbase++ 3rd Party libraries, which we would just call here as "Launch()."
Here's the way the Thread() was implemented:
***
FUNCTION Launch( cFuncName,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,;
x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,;
x21,x22,x23,x24,x25,x26,x27,x28 )
LOCAL oThread
oThread:=Thread():New()
oThread:Start( cFuncName,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,;
x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,;
x21,x22,x23,x24,x25,x26,x27,x28 )
RETURN NIL
The following is the usage of Launch() right at the Main Menu Option of the program. The rationale is for the multi-threading system to kick in, when there are many users sharing the same dbf file.
***
PULLDOWN(;
{{ "File" ,,;
{{ "Edit DBF" ,,{ || Launch(Edit1()) }},;
{ "Exit" ,,{ || Exit_1() }} }}...
***
IF !hb_mtvm()
? "There is no support for multi-threading, clocks will not be seen."
WAIT
ELSE
hb_threadStart( @Show_Time() )
ENDIF
From Kresin's tutorial, I created a function that would somehow simulate Xbase++'s "Launch()"
***
FUNCTION Try_Launch( givefuncnamehere,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15 )
RETURN hb_threadStart( @givefuncnamehere,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15 )
Then, I used Try_Launch() at the Main Menu:
***
PULLDOWN(;
{{ "File" ,,;
{{ "Edit DBF" ,,{ || Try_Launch(Edit1()) }},;
{ "Exit" ,,{ || Exit_1() }} }}...
It didn't work. FYI: I used option -mt in hbmk2.
Thanks so much. (I'm visiting and reading emails from this forum almost daily. Thanks for your time and generousity, guys!)
Jun P. Espina