1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.5
4: Copyright (C) 1989-2011 Dr. BERTRAND Joël
5:
6: This file is part of RPL/2.
7:
8: RPL/2 is free software; you can redistribute it and/or modify it
9: under the terms of the CeCILL V2 License as published by the french
10: CEA, CNRS and INRIA.
11:
12: RPL/2 is distributed in the hope that it will be useful, but WITHOUT
13: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14: FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License
15: for more details.
16:
17: You should have received a copy of the CeCILL License
18: along with RPL/2. If not, write to info@cecill.info.
19: ================================================================================
20: */
21:
22:
23: #include "rpl-conv.h"
24:
25:
26: /*
27: ================================================================================
28: Fonction 'restart'
29: ================================================================================
30: Entrées : pointeur sur une structure struct_processus
31: --------------------------------------------------------------------------------
32: Sorties :
33: --------------------------------------------------------------------------------
34: Effets de bord : néant
35: ================================================================================
36: */
37:
38: void
39: instruction_restart(struct_processus *s_etat_processus)
40: {
41: struct timespec attente;
42:
43: (*s_etat_processus).erreur_execution = d_ex;
44:
45: if ((*s_etat_processus).affichage_arguments == 'Y')
46: {
47: printf("\n RESTART ");
48:
49: if ((*s_etat_processus).langue == 'F')
50: {
51: printf("(réinitialisation du programme)\n\n");
52: printf(" Aucun argument\n");
53: }
54: else
55: {
56: printf("(program reinitialization)\n\n");
57: printf(" No argument\n");
58: }
59:
60: return;
61: }
62: else if ((*s_etat_processus).test_instruction == 'Y')
63: {
64: (*s_etat_processus).nombre_arguments = -1;
65: return;
66: }
67:
68: if (test_cfsf(s_etat_processus, 31) == d_vrai)
69: {
70: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
71: {
72: return;
73: }
74: }
75:
76: envoi_signal_processus((*s_etat_processus).pid_processus_pere,
77: rpl_sigabort);
78: (*s_etat_processus).requete_arret = 'Y';
79:
80: attente.tv_sec = 0;
81: attente.tv_nsec = GRANULARITE_us * 1000;
82:
83: while((*s_etat_processus).var_volatile_requete_arret == 0)
84: {
85: scrutation_interruptions(s_etat_processus);
86: nanosleep(&attente, NULL);
87: INCR_GRANULARITE(attente.tv_nsec);
88: }
89:
90: if ((*s_etat_processus).traitement_instruction_halt == d_vrai)
91: {
92: (*s_etat_processus).execution_pas_suivant = d_vrai;
93: }
94:
95: (*s_etat_processus).requete_redemarrage = d_vrai;
96: return;
97: }
98:
99: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>