Re: Thread Doubt.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ram (ramanasoory_at_hotmail.com)
Date: 11/24/04


Date: Wed, 24 Nov 2004 20:27:44 +0530

Ok. The problem goes like this: I have the main window that listens for
events from devices and COM components. The main window spawns childs (since
there are many to listen to) and starts listening. Whenever the main thread
receives events from these thread, the UI has to be updated. Now I want the
UI updation to happen in separate thread rather than in the main thread. So
I thought of having another thread just to paint and update the UI as I do
not want to overload the main thread as it has to listen for events from
other child thread.
I used to work with CWinThread in vc and everything seems to be possible for
me using PostThreadMessage. Here the equivalent of CWinThread is missing.(or
am I missing something ?)
I am new to C# and till now my exp are with vc. I have to try it out with
ThreadPool.

"John Murray" <jtm@io.com> wrote in message
news:et3sJLj0EHA.2804@TK2MSFTNGP15.phx.gbl...
> Perhaps I am missing something, but why would you have a thread spun up
> that has nothing to do. If all the child thread is doing is waiting for
> an event from the parent, why not have the parent use a thread from the
> thread pool when a new event occurs that it cares about. Another option
> would be to use an AsynchDelegate ... which may give you some other
> benefits as far as error handling ..etc..
>
> John
>
>
>
> Ram wrote:
> > Hi,
> > I have two threads, one parent thread containing UI and a child
thread
> > waiting for some events from the parent thread. Now, I have two issues:
1)
> > to keep the child thread active till the end of parent thread. 2) Fire
event
> > from the parent thread to child thread.
> >
> > To keep the child thread active, i tried different means including
> > while(1){ application.DoEvents()} but seems that it is not working. I am
> > unable to make it work.
> >
> > For the event, I am able to fire events from the child to parent using
> > delegates, But how to fire it from the parent to child?
> >
> > Thanx
> > Ram
> >
> >



Relevant Pages

  • Re: Question on learning skills of 4 yr old
    ... Uses the pictures in a book to tell a story ... Groups objects on basis of size, color, or shape ... Do you need to be an interpreter for your child, ... that can be heard unless someone listens .. ...
    (misc.kids)
  • Re: Toddler and stairs
    ... If you want a child to listen, ... "When you finish the drawing, ... Stay calm even when your child is not calm. ... that can be heard unless someone listens .. ...
    (misc.kids)
  • Getting Toddlers to Listen
    ... If you want a child to listen, ... "When you finish the drawing, ... Stay calm even when your child is not calm. ... that can be heard unless someone listens .. ...
    (misc.kids)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)
  • Unix Programming FAQ (v1.37)
    ... Why use _exit rather than exit in the child branch of a fork? ... Why doesn't my process get SIGHUP when its parent dies? ... How do I create a named pipe? ... How do I compare strings using regular expressions? ...
    (comp.unix.programmer)