|
Log in |
FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Can a TNxSession be used in a different thread from its creating thread?
Hi
In my application, there is a master thread M, which, during the life span of the application, spawns many other child threads, say, A1, A2... An. When M creates its child thread, it first creates a TNxSession instance, and passes that instance to the child thread. The child thread will use the TNxSession instance to access a NxServer. My question is, is there any potential problem for this relationship? Does a TNxSession (also TNxDatabae, TNxQuery) have to be used in the SAME thread that creates it? Thanks Wuping |
#2
|
|||
|
|||
Re: Can a TNxSession be used in a different thread from its creating thread?
Wuping Xin wrote:
> In my application, there is a master thread M, which, during the life span > of the application, spawns many other child threads, say, A1, A2... An. > > When M creates its child thread, it first creates a TNxSession instance, and > passes that instance to the child thread. The child thread will use the > TNxSession instance to access a NxServer. > > My question is, is there any potential problem for this relationship? Does > a TNxSession (also TNxDatabae, TNxQuery) have to be used in the SAME thread > that creates it? Sessions do not have an affinity to the thread that created them. You can pass them (and any component linked to that session) freely between threads. *BUT* you cannot access a session (which includes any component linked to it) in the context of multiple threads concurrently. |
#3
|
|||
|
|||
Re: Can a TNxSession be used in a different thread from its creating thread?
> In my application, there is a master thread M, which, during the
> life span of the application, spawns many other child threads, say, > A1, A2... An. You might be interested in the TnxSessionPool class, along with the various TnxTreadWithSession etc classes in nxdb.pas. -- Eivind Bakkestuen [NDD] |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
nxServerComponents in a thread | =?ISO-8859-1?Q?Cl=E9mentDoss?= | nexusdb.public.support | 2 | 6th October 2008 11:03 AM |
Please have a look at the thread: When will be available AWE server 2.07.02? | Petr Manas | nexusdb.public.support | 3 | 28th November 2007 05:34 PM |
Thread question... | Jon P. Grewer | nexusdb.public.discussions | 2 | 24th July 2007 06:09 AM |
Heartbeat thread | Sandor Dobi | nexusdb.public.support | 7 | 24th March 2007 03:52 AM |
Thorsten, Thread example ... | Scott Martin | nexusdb.public.discussions | 4 | 30th June 2006 09:22 PM |