Changeset 14545 for trunk/FACT++


Ignore:
Timestamp:
10/31/12 14:27:11 (12 years ago)
Author:
tbretz
Message:
Before commands are executed (cmd, exec) we wait now until we are sure the state machine is ready, otherwise somthing else could change the state before it get initialized.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Main.h

    r14016 r14545  
    191191        thread t(bind(Main::Thread, &io_service, dummy, ref(ret)));
    192192
     193        // Wait until state machine is ready (The only case I can imagine
     194        // in which the state will never chane is when DIM triggers
     195        // an exit before the state machine has been started at all.
     196        // Hopefully checking the readline (see Threed) should fix
     197        // that -- difficult to test.)
     198        while (io_service.GetCurrentState()<StateMachineImp::kSM_Ready && !shell.IsStopped())
     199            usleep(1);
     200
     201        // Execute command line commands
    193202        const vector<string> v1 = conf.Vec<string>("cmd");
    194203        for (vector<string>::const_iterator it=v1.begin(); it!=v1.end(); it++)
     
    199208            shell.Execute(*it, args);
    200209
     210        // Run the shell if no immediate exit was requested
    201211        if (!conf.Get<bool>("quit"))
    202             shell.Run();             // Run the shell
     212            shell.Run();
    203213
    204214        io_service.Stop();           // Signal Loop-thread to stop
Note: See TracChangeset for help on using the changeset viewer.