00001
00002
00003
00004
00005
00006
00007
00008 #include <utility/ostream.h>
00009 #include <alarm.h>
00010
00011 __USING_SYS
00012
00013 const int iterations = 100;
00014
00015 void func_a(void);
00016 void func_b(void);
00017
00018 OStream cout;
00019
00020 int main()
00021 {
00022 cout << "Alarm test\n";
00023
00024 cout << "I'm the first thread of the first task created in the system.\n";
00025 cout << "I'll now create two alarms and put myself in a delay ...\n";
00026
00027 Alarm alarm_a(1000000, &func_a, iterations);
00028 Alarm alarm_b(1000000, &func_b, iterations);
00029
00030 Alarm::delay(1000000 * (iterations * 2 + 1));
00031
00032 cout << "I'm done, bye!\n";
00033
00034 return 0;
00035 }
00036
00037 void func_a()
00038 {
00039 for(int i = 0; i < 79; i++)
00040 cout << "a";
00041 cout << "\n";
00042 }
00043
00044 void func_b(void)
00045 {
00046 for(int i = 0; i < 79; i++)
00047 cout << "b";
00048 cout << "\n";
00049 }