void verif_solu(int i, char **param) { int erreur; erreur = 0; if (param == NULL) return ; if (param[1] != NULL) if (param[1][1] == '=') { if (get_nb(param[1]) > (i + 1)) erreur = 1; } else (get_nb(param[1]) > i) ? erreur = 1 : 0; if (param[2] != NULL) if (param[2][1] == '=') { (get_nb(param[2]) < (i - 1)) ? erreur = 1 : 0; } else (get_nb(param[2]) <= i) ? erreur = 1: 0; if (erreur == 1) { my_error_putstr("pas de solution\n"); exit (0); } }
char *param_inf(char *res, char *str) { if (res == NULL) return (str); if (get_nb(str) < get_nb(res)) return (str); if (get_nb(str) == get_nb(res)) if (str[1] != '=' && res[1] == '=') return (str); return (res); }
void sync_const() { String s; Form2->Edit1->Text = get_nb(); Form2->Edit2->Text = get_k(); Form2->Edit3->Text = make_name(get_Pb()); Form2->Edit4->Text = make_name(get_E()); Form2->Edit5->Text = make_name(get_G()); }
worker_id_t controller_t::random_other() { int nb_workers = get_nb(); assert(nb_workers > 1); worker_id_t id = (worker_id_t)myrand() % (nb_workers-1); if (id >= get_my_id()) id++; return id; }
void* controller_t::ping_loop(void* arg) { group_p group = (group_p)arg; int nb_workers = get_nb(); long ping_delay_nsec = 1000 * (long)cmdline::parse_or_default_int("ping", 2000); ping_delay_nsec /= nb_workers; worker_id_t tgt = 0; while (! group->ping_loop_should_exit) { if ( group->ping_received[tgt] && (ticks::nanoseconds_since(group->last_ping_date[tgt]) > ping_delay_nsec || group->get_controller(tgt)->should_be_interrupted())) { group->ping_received[tgt] = false; group->last_ping_date[tgt] = ticks::now(); the_group.send_interrupt(tgt); } tgt = (tgt + 1) % nb_workers; } return NULL; }