int server_run(void) { int fd; while (1) { fd = s_accept(listen_sock, NULL, NULL); if (fd < 0) { syslog(LOG_ERR, "accept() failed: %m"); switch (errno) { case EBADF: case EMFILE: case ENODEV: case ENOMEM: case ENOTSOCK: case EOPNOTSUPP: case EWOULDBLOCK: return -1; } } request_run(fd, 0); } }
void button_pressed(ButtonID id) { g_mutex_lock(mutex); // Push request for message thread and request execution presses.push_back(id); request_run(ctx_messageContext); toggle_button_state(id); g_mutex_unlock(mutex); }