Why does my application never terminate

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthias Jentsch

    #1

    Why does my application never terminate

    Hello,

    I have a simple testapplication :

    public class Test : ApplicationCont ext
    {
    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.



  • Jhon

    #2
    Re: Why does my application never terminate

    Hi,
    <inline>

    "Matthias Jentsch" <Matthias.jents ch@gef.de> wrote in message
    news:bmml1b$i38 $1@cvs-server.gef.de.. .[color=blue]
    > Hello,
    >
    > I have a simple testapplication :
    >
    > public class Test : ApplicationCont ext
    > {
    > private static void Main ()
    > {
    > Application.Run (new Test());
    > }[/color]

    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
    [color=blue]
    >
    > 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.
    >
    >
    >[/color]


    Comment

    • Matthias Jentsch

      #3
      Re: Why does my application never terminate

      Thanks.

      Matthias

      "Jhon" <Jhon@a.a> schrieb im Newsbeitrag
      news:GcGjb.8254 9$Vc3.4330591@p hobos.telenet-ops.be...[color=blue]
      > Hi,
      > <inline>
      >
      > "Matthias Jentsch" <Matthias.jents ch@gef.de> wrote in message
      > news:bmml1b$i38 $1@cvs-server.gef.de.. .[color=green]
      > > Hello,
      > >
      > > I have a simple testapplication :
      > >
      > > public class Test : ApplicationCont ext
      > > {
      > > private static void Main ()
      > > {
      > > Application.Run (new Test());
      > > }[/color]
      >
      > 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[/color]
      stopped[color=blue]
      > 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
      >[color=green]
      > >
      > > public Test()
      > > {
      > > ExitThread();
      > > }
      > > }
      > >
      > > When i run this application the application never exists. But why? I[/color][/color]
      think[color=blue][color=green]
      > > when i'm calling the ExitThread-Method the my application should exit.
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Laszlo Szijarto

        #4
        Re: Why does my application never terminate

        use Application.Exi t();


        Comment

        Working...