6 #include <pbd/base_ui.h>
8 #include <pbd/compose.h>
9 #include <pbd/failed_constructor.h>
16 uint32_t BaseUI::rt_bit = 1;
17 BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type();
19 BaseUI::BaseUI (string str, bool with_signal_pipe)
22 /* odd pseudo-singleton semantics */
24 base_ui_instance = this;
29 if (with_signal_pipe) {
30 if (setup_signal_pipe ()) {
31 throw failed_constructor ();
38 if (signal_pipe[0] >= 0) {
39 close (signal_pipe[0]);
42 if (signal_pipe[1] >= 0) {
43 close (signal_pipe[1]);
48 BaseUI::new_request_type ()
52 /* XXX catch out-of-range */
54 rt = RequestType (rt_bit);
61 BaseUI::setup_signal_pipe ()
63 /* setup the pipe that other threads send us notifications/requests
67 if (pipe (signal_pipe)) {
68 error << string_compose (_("%1-UI: cannot create error signal pipe (%2)"), _name, std::strerror (errno))
74 if (fcntl (signal_pipe[0], F_SETFL, O_NONBLOCK)) {
75 error << string_compose (_("%1-UI: cannot set O_NONBLOCK on signal read pipe (%2)"), _name, std::strerror (errno))
80 if (fcntl (signal_pipe[1], F_SETFL, O_NONBLOCK)) {
81 error << string_compose (_("%1-UI: cannot set O_NONBLOCK on signal write pipe (%2)"), _name, std::strerror (errno))