Let me be more explicit on the problem: i've been making some testings on my
application and i realized that the application hangs in this situation:
I have a main window created in the thread which called Application.Run so
it has the message loop right? Well, then i have another thread wich
represents an entity which has to do its own operations (worker thread
created with the thread object) .Then i ask my thread object to show a
monitor where it has to write its progress in the operation, this monitor is
a non-modal dialog. The worker thread calls a method to obtain the form
which represents that monitor: this method will do a call of the Invoke
method in the form object which represents the main form of the application
and which was created in the thread which called the Application.Run
method,follow me? : ) .this invoking is to ask the UI thread to create a
monitor form object (i have to create the monitor object in the UI Thread as
it will be a non modal dialog which i will show using its Show method so it
won't have a message queue by itself ,this is the opposite to what happens if
i want it to be a modal dialog:then i call the showdialog method and it will
have its own messagequeue and it is not necessary for it to be created in the
UI Thread)
well thn the worker thread gets its monitor form object and do an Invoke to
call its Show method to display it.
Periodically the worker thread will do an Invoking to call a methos wich
updates the fields of the monitor object.
Well everything goes fine but when the monitor is running and i start moving
the main form from one side to other of the screen then the hang of the
application comes up. I think that it could be because i created the monitor
object in such a way that it share the messagequeu of the main form of the
application(creating this object in the UI Thread).
The problem is that i havent found the way to give a non modal dialog its
own message queue independent of the message queu of teh main form.
anybodu thinks that this could be the problem???? THANKS

Re: Problem with multithreaded application (Cont.) by MuZZy

MuZZy
Fri Apr 07 11:21:06 CDT 2006

Can you try to reproduce the bug on a smaller/simpler version of your
app which you could email me? I could take a look then.

eduwushu wrote:
> Let me be more explicit on the problem: i've been making some testings on my
> application and i realized that the application hangs in this situation:
> I have a main window created in the thread which called Application.Run so
> it has the message loop right? Well, then i have another thread wich
> represents an entity which has to do its own operations (worker thread
> created with the thread object) .Then i ask my thread object to show a
> monitor where it has to write its progress in the operation, this monitor is
> a non-modal dialog. The worker thread calls a method to obtain the form
> which represents that monitor: this method will do a call of the Invoke
> method in the form object which represents the main form of the application
> and which was created in the thread which called the Application.Run
> method,follow me? : ) .this invoking is to ask the UI thread to create a
> monitor form object (i have to create the monitor object in the UI Thread as
> it will be a non modal dialog which i will show using its Show method so it
> won't have a message queue by itself ,this is the opposite to what happens if
> i want it to be a modal dialog:then i call the showdialog method and it will
> have its own messagequeue and it is not necessary for it to be created in the
> UI Thread)
> well thn the worker thread gets its monitor form object and do an Invoke to
> call its Show method to display it.
> Periodically the worker thread will do an Invoking to call a methos wich
> updates the fields of the monitor object.
> Well everything goes fine but when the monitor is running and i start moving
> the main form from one side to other of the screen then the hang of the
> application comes up. I think that it could be because i created the monitor
> object in such a way that it share the messagequeu of the main form of the
> application(creating this object in the UI Thread).
> The problem is that i havent found the way to give a non modal dialog its
> own message queue independent of the message queu of teh main form.
> anybodu thinks that this could be the problem???? THANKS

Re: Problem with multithreaded application (Cont.) by eduwushu

eduwushu
Fri Apr 07 12:29:49 CDT 2006

OK CAN YOU SEND ME YOUR EMAIL PLIZ I WILL TRY TO SEND YOU THE MAIL THERE.

"MuZZy" wrote:

> Can you try to reproduce the bug on a smaller/simpler version of your
> app which you could email me? I could take a look then.
>
> eduwushu wrote:
> > Let me be more explicit on the problem: i've been making some testings on my
> > application and i realized that the application hangs in this situation:
> > I have a main window created in the thread which called Application.Run so
> > it has the message loop right? Well, then i have another thread wich
> > represents an entity which has to do its own operations (worker thread
> > created with the thread object) .Then i ask my thread object to show a
> > monitor where it has to write its progress in the operation, this monitor is
> > a non-modal dialog. The worker thread calls a method to obtain the form
> > which represents that monitor: this method will do a call of the Invoke
> > method in the form object which represents the main form of the application
> > and which was created in the thread which called the Application.Run
> > method,follow me? : ) .this invoking is to ask the UI thread to create a
> > monitor form object (i have to create the monitor object in the UI Thread as
> > it will be a non modal dialog which i will show using its Show method so it
> > won't have a message queue by itself ,this is the opposite to what happens if
> > i want it to be a modal dialog:then i call the showdialog method and it will
> > have its own messagequeue and it is not necessary for it to be created in the
> > UI Thread)
> > well thn the worker thread gets its monitor form object and do an Invoke to
> > call its Show method to display it.
> > Periodically the worker thread will do an Invoking to call a methos wich
> > updates the fields of the monitor object.
> > Well everything goes fine but when the monitor is running and i start moving
> > the main form from one side to other of the screen then the hang of the
> > application comes up. I think that it could be because i created the monitor
> > object in such a way that it share the messagequeu of the main form of the
> > application(creating this object in the UI Thread).
> > The problem is that i havent found the way to give a non modal dialog its
> > own message queue independent of the message queu of teh main form.
> > anybodu thinks that this could be the problem???? THANKS
>