VueGestionEnsemble::VueGestionEnsemble(QWidget* parent) : QDialog(parent), ui(new Ui::VueGestionEnsemble) { ui->setupUi(this); nom = new ChampFormulaire(tr("Ce champ est requis."), this); nom->setFocus(); ui->formLayout->setWidget(0,QFormLayout::FieldRole, nom); configurerBoutonOk(); setTabOrder(nom->getChamp(), ui->champDescription); connect(nom, SIGNAL(valeurChangee()), this, SLOT(verifierNom())); ui->boutonAjouter->setEnabled(false); ui->boutonRetirer->setEnabled(false); connect(ui->listeExistantes, SIGNAL(activated(QModelIndex)), this, SLOT(horsEnsembleSelectionnee())); connect(ui->listeExistantes, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(ajouter())); connect(ui->boutonAjouter, SIGNAL(clicked()), this, SLOT(ajouter())); connect(ui->listeSelectionnees, SIGNAL(clicked(QModelIndex)), this, SLOT(dansEnsembleSelectionnee())); connect(ui->listeSelectionnees, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(retirer())); connect(ui->boutonRetirer, SIGNAL(clicked()), this, SLOT(retirer())); connect(ui->boutonNouvelle, SIGNAL(clicked()), this, SLOT(creerAction())); }
/* Crée n consommateurs */ void fork_consommateur(int n, long type, int id_file){ MSG *m=NULL; pid_t f = 1; /* Seul le père crée des fils */ for (int i=0; i < n && f > 0; i++){ f = fork(); } /* Bloc fils */ if(f==0){ m = retirer(type, id_file); printf("Conso de type %d retire msg de type %d: %d\n",(int)type,(int)m->type,m->contenu); fflush(stdout); free(m); /* Le fils se termine */ exit(0); } }