fix some race conditions and execution order of callbacks given in simulate commands inside postinit_commands at startup

This commit is contained in:
stefan schippers 2024-03-08 19:19:30 +01:00
parent 904526408b
commit ddcac8c69c
3 changed files with 15 additions and 18 deletions

View File

@ -143,7 +143,7 @@ const char *get_text_floater(int i)
int set_modify(int mod)
{
int i, floaters = 0;
dbg(1, "set_modify(): %d, prev_set_modify=%d\n", mod, xctx->prev_set_modify);
/* set modify state */
@ -158,8 +158,8 @@ int set_modify(int mod)
tclvareval("set tctx::", xctx->current_win_path, "_netlist $simulate_bg", NULL);
my_snprintf(s, S(s), "tctx::%s_simulate_id", xctx->current_win_path);
if(tclgetvar(s)) {
tclvareval(xctx->top_path, ".menubar.simulate configure -bg orange", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate orange", NULL);
tclvareval(xctx->top_path, ".menubar.simulate configure -bg ", tclresult(), NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate ", tclresult(), NULL);
} else {
tclvareval(xctx->top_path, ".menubar.simulate configure -bg $simulate_bg", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL);

View File

@ -285,6 +285,12 @@ proc execute_fileevent {id} {
}
set execute(exitcode,last) $exit_status
set execute(exitcode,$id) $exit_status
set execute(cmd,last) $execute(cmd,$id)
set execute(win_path,last) $execute(win_path,$id)
set execute(data,last) $execute(data,$id)
if { ![info exists err] } { set err {} }
set execute(error,last) $err
set execute(status,last) $execute(status,$id)
if {[info exists execute(callback,$id)] && $execute(callback,$id) ne {}} {
# puts $execute(callback,$id)
# puts $execute(win_path,$id)
@ -296,12 +302,6 @@ proc execute_fileevent {id} {
}
}
catch {unset execute(callback,$id)}
set execute(cmd,last) $execute(cmd,$id)
set execute(win_path,last) $execute(win_path,$id)
set execute(data,last) $execute(data,$id)
if { ![info exists err] } { set err {} }
set execute(error,last) $err
set execute(status,last) $execute(status,$id)
if { ![info exists exit_status] } { set exit_status 0 }
unset execute(pipe,$id)
unset execute(data,$id)
@ -2014,8 +2014,6 @@ proc simulate {{callback {}}} {
set_simulate_button [list [xschem get top_path] [xschem get current_win_path]]
$callback
"
# puts $cmd
if {$fg eq {execute_wait}} {xschem set semaphore [expr {[xschem get semaphore] +1}]}
set save [pwd]
@ -7002,12 +7000,12 @@ proc set_simulate_button {top_path winpath} {
set simvar tctx::${winpath}_simulate
set sim_button $top_path.menubar.simulate
# puts "current_win=$current_win"
# puts "simvar=$simvar"
# puts "winpath=$winpath"
# puts "top_path=$top_path"
# puts "sim_button=$sim_button"
# puts "execute(exitcode,last)=$execute(exitcode,last)"
# puts "current_win=|$current_win|"
# puts "simvar=|$simvar|"
# puts "winpath=|$winpath|"
# puts "top_path=|$top_path|"
# puts "sim_button=|$sim_button|"
# puts "execute(exitcode,last)=|$execute(exitcode,last)|"
if {![info exists execute(exitcode,last)]} {
if { $current_win eq $winpath} {

View File

@ -480,7 +480,6 @@
# xschem raw read $netlist_dir/solar_panel.raw
# xschem redraw
# }
# xschem raw read $netlist_dir/solar_panel.raw
# viewdata $messages ro
# }