Cleanup in elf.c with .bss section clean; adm command mounts cdrom instead of floppy...
[ZeXOS.git] / apps / threadtest / main.c
blob44a87b514924c2abb22d438d7cf514757a4331a5
1 /*
2 * ZeX/OS
3 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdlib.h>
23 #include <pthread.h>
24 #include <unistd.h>
26 #define ESC 1
28 unsigned key_handler ()
30 int scancode = getkey ();
32 switch (scancode) {
33 case ESC:
34 exit (1);
35 return 0;
38 return 0;
41 void *handler_thread (void *r)
43 for (;;) {
44 printf ("Thread %s\n", (char *) r);
46 sleep (1);
47 schedule ();
50 return 0;
53 int main (int argc, char **argv)
55 printf ("This is example program for pthread library\nPress ESC to exit\n");
57 pthread_t thread;
58 pthread_create (&thread, NULL, handler_thread, "1");
60 pthread_t thread2;
61 pthread_create (&thread2, NULL, handler_thread, "2");
63 for (;;) {
64 key_handler ();
66 schedule ();
69 return 0;