int shutdown_server() { message_t* msg; serv_up = 0; // Create NONE message if ( ( msg=new_message(NONE ) ) == NULL ) { fprintf(logfile,"Error when creating NONE message\n"); return -1; } // Post it message to mailbox mbox_post( mbox, msg); // Wait for server to finish the work counting_sem_wait(msg->op_completed); // Ignore answer if (msg != NULL) free_message(msg); return 0; }
int get_signal() { counting_sem_wait(access_controller); return last_signal; }