My Project
Chargement...
Recherche...
Aucune correspondance
init.c
Aller à la documentation de ce fichier.
1
7#include <manux/config.h>
8#include <manux/types.h>
9#include <stdio.h>
10#include <unistd.h>
11
12#include <manux/i386.h> // halt
13
15/*
16 * Calcul et affichage des nombres premiers. Le but est juste de faire
17 * bosser le processeur, donc on ne cherche pas du tout à faire les
18 * choses vite ou bien.
19 */
20{
21 int n; /* Indice de la boucle de recherche d'un premier*/
22 int d; /* Indice de la boucle de recherche de diviseur */
23 booleen compose;
24 int cpt = 1;
25 int nbLu;
26
27 char txt[32];
28
29 while (TRUE) {
30 printf("[%d] C'est la boucle numero %d : \n", q, cpt++);
31 printf("%d", 2);
32 while(1){}; for (n = 3; n < 32; n += 2) {
33 compose = FALSE;
34 d = 3;
35 while ((!compose) && (d*d <= n)) {
36 compose = compose || (n%d == 0);
37 d += 2;
38 }
39 if (!compose) {
40 printf(", %d", n); for (int i = 0; i<10000000; i+=2){asm("");};
41 }
42 }
43 printf("\n--------------------------------------------------------------------------------\n");
44
45 // Test du clavier et stdin
46 nbLu = lire(0, txt, 31);
47 if (nbLu) {
48 txt[nbLu] = 0;
49 printf(" Lu %d => '%s'\n", nbLu, txt);
50 }
51
52#ifndef MANUX_PREEMPTIF
54#endif
55 }
56}
57
59{
60 int n;
61
62 printf("Deuxieme tache\n");
63
64 for (n = 0; n < 10000000; n++) {
66 }
67}
68
69void init()
70{
71 int n=2; // nombre de messages affichés
72
73 printf("Greetings from userland !\n");
74
76
77 for (n = 0; n < 10000000; n++) {
79 }
80}
int booleen
Definition types.h:32
#define TRUE
Definition types.h:36
#define FALSE
Definition types.h:40
void init()
Definition init.c:69
void deuxiemeTache()
Definition init.c:58
void calculerPremiers(int q)
Definition init.c:14
uint16_t d
int lire(int fd, void *buffer, int nb)
void printf(char *format,...)
Un premier printf.
Definition stdio.c:142
int basculerTache()
Basculer vers une autre tâche. On rend simplement la main, c'est du collaboratif.
int creerNouvelleTache(void(corps()), booleen shareCons)
Création d"une nouvelle tâche.