Skip to content

Commit

Permalink
directvt#650: Make access to settings synchronized with UI thread
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Oct 16, 2024
1 parent 2cf564b commit c82911a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/netxs/apps/calc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ namespace netxs::app::calc
});
auto object = window->attach(ui::fork::ctor(axis::Y))
->colors(whitelt, 0);
config.cd("/config/defapp");
auto menu = object->attach(slot::_1, app::shared::menu::demo(config));
auto all_rail = object->attach(slot::_2, ui::rail::ctor());
auto all_stat = all_rail->attach(ui::fork::ctor(axis::Y))
Expand Down
1 change: 1 addition & 0 deletions src/netxs/apps/text.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ displaying the requested definition in a popup window or temporary buffer. Some
});
auto object = window->attach(ui::fork::ctor(axis::Y))
->colors(whitelt, 0xA0'00'1a'5f);
config.cd("/config/defapp");
auto menu = object->attach(slot::_1, app::shared::menu::demo(config));
auto body_area = object->attach(slot::_2, ui::fork::ctor(axis::Y));
auto fields = body_area->attach(slot::_1, ui::pads::ctor(dent{ 1,1 }));
Expand Down
4 changes: 4 additions & 0 deletions src/netxs/desktopio/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ namespace netxs::app::shared
else
{
os::dtvt::client = client;
auto config_lock = ui::tui_domain().unique_lock(); // Sync multithreaded access to config.
auto winstate = config.take("/config/gui/winstate", win::state::normal, app::shared::win::options);
auto aliasing = config.take("/config/gui/antialiasing", faux);
auto blinking = config.take("/config/gui/blinkrate", span{ 400ms });
Expand All @@ -621,6 +622,7 @@ namespace netxs::app::shared
//todo implement 'fonts/font/file' - font file path/url
fontlist.push_back(f->take_value());
}
config_lock.unlock();
auto connect = [&]
{
auto event_domain = netxs::events::auth{};
Expand All @@ -647,9 +649,11 @@ namespace netxs::app::shared
{
app::shared::splice(client, config);
}};
auto config_lock = ui::tui_domain().unique_lock(); // Sync multithreaded access to config.
auto domain = ui::host::ctor(server, config)->plugin<scripting::host>();
auto appcfg = eccc{ .cmd = cmd, .cfg = os::dtvt::active ? ""s : "<config simple=1/>"s };
auto applet = app::shared::builder(aclass)(appcfg, config);
config_lock.unlock();
domain->invite(server, applet, os::dtvt::vtmode, os::dtvt::gridsz);
domain->stop();
server->shut();
Expand Down
4 changes: 3 additions & 1 deletion src/vtm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,12 @@ int main(int argc, char* argv[])
signal.reset();

using e2 = ui::e2;
auto config_lock = ui::tui_domain().unique_lock(); // Sync multithreaded access to config.
auto domain = ui::host::ctor<app::vtm::hall>(server, config);
domain->plugin<scripting::host>();
domain->autorun();
auto settings = config.utf8();
config_lock.unlock();

log("%%Session started"
"\n user: %userid%"
Expand Down Expand Up @@ -500,7 +503,6 @@ int main(int argc, char* argv[])
}
}};

auto settings = config.utf8();
auto execline = [&](qiew line){ domain->SIGNAL(tier::release, scripting::events::invoke, onecmd, ({ .cmd = line })); };
auto shutdown = [&]{ domain->SIGNAL(tier::general, e2::shutdown, msg, (utf::concat(prompt::main, "Shutdown on signal"))); };
execline(script);
Expand Down

0 comments on commit c82911a

Please sign in to comment.