Event loop to not exit my program

  • Thread starter Thread starter julien
  • Start date Start date
J

julien

Hello,
I need to add a waiting loop to my program so I don't exit right a way.
This loop has to be non-blocking (the program has to handle other
events), and shouldn't take much resources (not a busy waiting).

It is a command line program, so I don't get the event loop of any
graphical library.

I looked for "event loop" on Google but couldn't find anything for C#/.Net

Any idea?

Thank you
Julien
 
Hi Julien,
try this:
in the Dispose method before calling the base.Dispose() add a for loop with
the delay and in the for loop body write only Application.DoEvent, this is
a cruel way of doing it but that came out of the top of my head at this
time.
Hope that helps.
 
Hey,

Have you tryied looking for threaded waiting loop?

Can you explain your exact needs?

- Moty -
 
julien said:
Hello,
I need to add a waiting loop to my program so I don't exit right a way.
This loop has to be non-blocking (the program has to handle other events),
and shouldn't take much resources (not a busy waiting).

It is a command line program, so I don't get the event loop of any
graphical library.

I looked for "event loop" on Google but couldn't find anything for C#/.Net

Any idea?

Thank you
Julien

I assume you have a secondary thread running (or more) you could lock on an
object and when the lock is released you could exit. You can use a
WaitHandle object to wait on multiple objects etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top