RE: [Dev-C++] Multi-Threading locks up
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Santiago P. C. <San...@yd...> - 2003-09-17 16:39:46
|
Hi Ed,
Talking about the scenario where you show a MessageBox, in this situation=
=20an interval time is created between the launching of each thread, so p=
lease...
- check that each thread has not finished before you press the OK button.=
..
- (if the previous thread is still running) check the execution point whe=
re the previous thread is at when the next thread starts...
- check that the threads are not using static variables for temporary val=
ues or loops...
It seems there is a problem with the concurrent execution of your threads=
=20(when they run simultaneously), please check that they behave without =
problems...
Hope this helps!
Regards,
~Santy
-----Original Message-----
From: dev...@li... [mailto:dev-cpp-users-adm=
in...@li...] On Behalf Of Ed Cottrell
Sent: mi=E9rcoles, 17 de septiembre de 2003 17:59
To: dev...@li...
Subject: [Dev-C++] Multi-Threading locks up
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=
=20GUI) launches off a user-specified number of threads (say, 10), which =
then do the actually database queries.=20
I've hit a weird snag, though. As written, the threads all start properly=
, but then pause themselves, immediately, or almost immediately (after up=
dating 0 to maybe 500 records, out of several hundred thousand). The prob=
lem isn't on the database server end; it works fine, but reports that the=
=20threads have stopped running queries. Pseudo-code:
...
int i, MyThreads=3D10;
for(i =3D 0; i < MyThreads; i++)
=20 {
=20 //Splits up the work, here, into MyThreads chunks
=20 _beginthread( [the arguments] )
=20 }
...
This is where it gets weird... IF I create a message box first, the threa=
ds start properly AND run until finished! Pseudo-code:=20
...
int i, MyThreads=3D10;
char mymsg[10]
for(i =3D 0; i < MyThreads; i++)
=20 {=20
=20 //Splits up the work, here, into MyThreads chunks
=20 _beginthread( [the arguments] )=20
=20 sprintf(mymsg, "%d", i);
=20 MessageBox(0, mymsg, mymsg, MB_OK);
=20 }=20
...
The ONLY difference is in whether or not I show a message box. Anybody kn=
ow what that's about? Thanks a million!
-Ed
-------------------------------------------------------------------------=
-------------
This message and any files transmitted with it are confidential and inten=
ded solely=20
for the use of the individual or entity to whom they are addressed. No co=
nfidentiality=20
or privilege is waived or lost by any wrong transmission.=20
If you have received this message in error, please immediately destroy it=
=20and kindly=20
notify the sender by reply email.
You must not, directly or indirectly, use, disclose, distribute, print, o=
r copy any=20
part of this message if you are not the intended recipient. Opinions, con=
clusions and=20
other information in this message that do not relate to the official busi=
ness of=20
Ydilo Advanced Voice Solutions, S.A. shall be understood as neither given=
=20nor endorsed by it.=20
-------------------------------------------------------------------------=
-------------
|