Why does my application never terminate

  • Thread starter Thread starter Matthias Jentsch
  • Start date Start date
M

Matthias Jentsch

Hello,

I have a simple testapplication:

public class Test : ApplicationContext
{
private static void Main ()
{
Application.Run(new Test());
}

public Test()
{
ExitThread();
}
}

When i run this application the application never exists. But why? I think
when i'm calling the ExitThread-Method the my application should exit.
 
Hi,
<inline>

Matthias Jentsch said:
Hello,

I have a simple testapplication:

public class Test : ApplicationContext
{
private static void Main ()
{
Application.Run(new Test());
}

Application.Run is a methods which contains a message _loop_, where all
(form)events orginate from.

The Application.Run method doesn't return until this message loop is stopped
with eg. ExitThread.
..
The problem here is that _first_ a test object is created, which calls the
constructor, which calls ExitThread, but there is no message loop yet.
After the object is created, then Application.Run is called, which starts
the message loop.


HTH
greetings
 
Thanks.

Matthias

Jhon said:
Hi,
<inline>



Application.Run is a methods which contains a message _loop_, where all
(form)events orginate from.

The Application.Run method doesn't return until this message loop is stopped
with eg. ExitThread.
.
The problem here is that _first_ a test object is created, which calls the
constructor, which calls ExitThread, but there is no message loop yet.
After the object is created, then Application.Run is called, which starts
the message loop.


HTH
greetings
 
Back
Top