Page 1 of 1

hb_threadStart() and DBF

Posted: Mon Aug 22, 2022 5:26 am
by AUGE_OHR
hi,

i have a 2nd Windows to show MEMO which work

now i want to use hb_threadStart() for 2nd Windows but it fail
Error BASE/1002 Alias does not exist FORUM
Called from SHOWMEMOFORM(71)
Question : do i need to open DBF again when using hb_threadStart() :?:

p.s. CODE to show MEMO is in separate *.PRG

Re: hb_threadStart() and DBF

Posted: Mon Aug 22, 2022 9:10 am
by huiyi_ch
Now about the access to the databases in multi-threaded applications. working area (workareas) in the Harbour are local to the thread, i.e. each thread has its own independent workspaces and aliases, and, in the general case, if you need a database in the thread "B" which is already opened in the thread "A", you need to open it in the "B" agein, which is easy to do in shared mode.

Re: hb_threadStart() and DBF

Posted: Mon Aug 22, 2022 8:37 pm
by mol
If every thread has its own world, is the way to return some results from thread?

Re: hb_threadStart() and DBF

Posted: Tue Aug 23, 2022 1:10 am
by huiyi_ch
thread.png
thread.png (27.18 KiB) Viewed 4346 times

Re: hb_threadStart() and DBF

Posted: Tue Aug 23, 2022 6:15 am
by mol
thanks!

Re: hb_threadStart() and DBF

Posted: Tue Aug 23, 2022 4:36 pm
by AUGE_OHR
hi,

i was sick last Days so i have not Answer.

i thought DBF are "visible" in every Thread under harbour but like Xbase++ each Thread seem to have own Workspace.
now i have to find out how to "sync" Thread under harbour which i do under Xbase++ use "User-Def" Event

Code: Select all

PROCEDURE Thread_A
#define xbeMyPB_Base            0x79010000
#define xbeMyPB_DBLCLK          (xbeMyPB_Base + 1)
#define xbeMyPB_GOTO            (xbeMyPB_Base + 2)

   PostAppEvent(xbeMyPB_GOTO, RECNO(), , Thread_B)

Code: Select all

PROCEDURE Thread_B
  ...
  DO WHILE ( !lExit = .T. )
      nEvt := AppEvent(@mp1,@mp2,@oo )
      DO CASE
         CASE nEvt = xbeMyPB_GOTO
            GOTO(mp1)