Gil Delavous <[EMAIL PROTECTED]>
wrote:
However, what happens when a thread calls a method from the main
thread, this one using its own sqlite connection?
The question doesn't make any sense to me, sorry. Methods don't belong
to threads. Any function in a program can, in principle, be executed by
any thread at any time, including by multiple threads simultaneously.
For example:
Main thread:
void main::query_something() {
// query something using main thread's sqlite connection
}
Print thread:
void print::print_result() {
int value = main->query_something();
}
What makes you think these classes are somehow affine to a particular
thread? They are not. When you call query_something from print_result,
the same thread that executed print_result now executes query_something,
whether it's a "main" thread (whatever that means) or otherwise.
If it's your intention that all methods from class main be called on one
thread, and all methods of print be called on another, it's up to your
program to ensure that. You need some kind of inter-thread communication
mechanism, e.g. a producer/consumer queue.
As my main thread has tons of utility methods called from other
threads
You seem to say "thread" when you mean "class", and this lies at the
heart of your confusion. Realize that the two are entirely different,
largely unrelated concepts.
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------