58 registry = display_wrapper.get_registry();
66 registry.set_queue(queue);
69 registry.on_global() = [&seat, ®istry](std::uint32_t name, std::string interface, std::uint32_t version)
71 if(interface == seat_t::interface_name)
72 registry.bind(name, seat, version);
77 throw std::runtime_error(
"Did NOT get seat interface - thread-safety issue!");
89 seat = seat.proxy_create_wrapper();
91 seat.set_queue(queue2);
92 keyboard_t kbd = seat.get_keyboard();
93 bool have_keymap =
false;
94 kbd.on_keymap() = [&have_keymap](keyboard_keymap_format format,
int fd, std::uint32_t size)
102 throw std::runtime_error(
"Did NOT get keymap - thread-safety issue!");
107 std::thread bind_thread(
bool safe)
109 return std::thread{std::bind(&binder::bind,
this, safe)};
113 void run(
int thread_count,
int round_count,
bool safe)
115 std::atomic<bool> stop{
false};
116 std::cout <<
"Using " << thread_count <<
" threads, safe: " << safe << std::endl;
117 for(
int round = 0; round < round_count; round++)
121 std::cout <<
"Round " << round <<
"/" << round_count << std::endl;
123 std::vector<std::thread> threads;
124 for(
int i = 0; i < thread_count; i++)
126 threads.emplace_back(bind_thread(safe));
128 for(
auto& thread : threads)
137 int main(
int argc,
char** argv)
141 std::cerr <<
"Usage: " << argv[0] <<
" <thread count> <run count> <use safe mechanism?>" << std::endl;
145 b.run(std::stoi(argv[1]), std::stoi(argv[2]), std::stoi(argv[3]));
event_queue_t create_queue()
Create a new event queue for this display.
registry_t get_registry()
get global registry object
Represents a connection to the compositor and acts as a proxy to the display singleton object...
int roundtrip_queue(event_queue_t queue)
Block until all pending request are processed by the server.
void set_queue(event_queue_t queue)
Assign a proxy to an event queue.
display_t proxy_create_wrapper()
create proxy wrapper for this display