|
From: Ed C. <em...@to...> - 2003-09-17 16:01:26
|
Hi,
I'm working on a multi-threaded database app, which connects to multiple
databases and does data-mining. The main thread (which includes the Win32
GUI) launches off a user-specified number of threads (say, 10), which then
do the actually database queries.
I've hit a weird snag, though. As written, the threads all start properly,
but then pause themselves, immediately, or almost immediately (after
updating 0 to maybe 500 records, out of several hundred thousand). The
problem isn't on the database server end; it works fine, but reports that
the threads have stopped running queries. Pseudo-code:
...
int i, MyThreads=10;
for(i = 0; i < MyThreads; i++)
{
//Splits up the work, here, into MyThreads chunks
_beginthread( [the arguments] )
}
...
This is where it gets weird... IF I create a message box first, the threads
start properly AND run until finished! Pseudo-code:
...
int i, MyThreads=10;
char mymsg[10]
for(i = 0; i < MyThreads; i++)
{
//Splits up the work, here, into MyThreads chunks
_beginthread( [the arguments] )
sprintf(mymsg, "%d", i);
MessageBox(0, mymsg, mymsg, MB_OK);
}
...
The ONLY difference is in whether or not I show a message box. Anybody know
what that's about? Thanks a million!
-Ed
|