hb_threadStart() and DBF

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

hb_threadStart() and DBF

Post 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
have fun
Jimmy
huiyi_ch
Posts: 173
Joined: Sat May 21, 2016 5:27 am

Re: hb_threadStart() and DBF

Post 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.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: hb_threadStart() and DBF

Post by mol »

If every thread has its own world, is the way to return some results from thread?
huiyi_ch
Posts: 173
Joined: Sat May 21, 2016 5:27 am

Re: hb_threadStart() and DBF

Post by huiyi_ch »

thread.png
thread.png (27.18 KiB) Viewed 4342 times
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_threadStart() and DBF

Post 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) 
have fun
Jimmy
Post Reply