You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code tries to access a DBServer object from a different thread, than the one in which it was created, but it does not work, DBServer:Used returns FALSE and no db action can be performed on it. I guess this happens because the alias cannot be found in the new thread.
USING System.Threading
GLOBAL goDBserver AS DbServer
FUNCTION Start() AS VOID
LOCAL cDbf AS STRING
cDbf := "c:\test\abc"
DbCreate(cDbf , {{"FLD","C",10,0}})
goDBserver := DBServer{cDbf , FALSE}
? "Is it open in main thread?", goDBserver:Used // TRUE
LOCAL t AS Thread
t := Thread{MyThread}
t:Start()
System.Threading.Thread.Sleep(2000)
? "Is it still open in main thread?", goDBserver:Used // TRUE
? "Closing it now"
goDBserver:Close()
FUNCTION MyThread() AS VOID
? "Is it open in the new thread?", goDBserver:Used // FALSE
? "It is closed, so DBAppend() also returns", DbAppend() // FALSE
The text was updated successfully, but these errors were encountered:
Impossible ? No. Difficult yes.
The current design of the DbServer class uses the area number and alias internally. In the background thread these alias and number have no meaning.
If it would use the RDD object then it would be easier. I'll see if we can redesign the DBServer class for this purpose.
The following code tries to access a DBServer object from a different thread, than the one in which it was created, but it does not work, DBServer:Used returns FALSE and no db action can be performed on it. I guess this happens because the alias cannot be found in the new thread.
The text was updated successfully, but these errors were encountered: