- Timestamp:
- Jan 14, 2021, 2:32:36 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 7223dbf2
- Parents:
- ee59ede
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
ree59ede r153dc387 11 11 12 12 #include <kernel.hfa> 13 #include <iofwd.hfa> 13 14 #include <stats.hfa> 14 15 #include <time.hfa> … … 48 49 extern void init_protocol(void); 49 50 extern void deinit_protocol(void); 51 52 //============================================================================================= 53 // Stats Printer 54 //=============================================================================================' 55 56 thread StatsPrinter {}; 57 58 void ?{}( StatsPrinter & this ) { 59 ((thread&)this){ "Stats Printer Thread" }; 60 } 61 62 void main(StatsPrinter & this) { 63 LOOP: for() { 64 waitfor( ^?{} : this) { 65 break LOOP; 66 } 67 or else {} 68 69 sleep(10`s); 70 71 print_stats_now( *options.clopts.instance, CFA_STATS_READY_Q | CFA_STATS_IO ); 72 } 73 } 50 74 51 75 //============================================================================================= … … 128 152 { 129 153 ServerProc procs[options.clopts.nprocs]; 154 StatsPrinter printer; 130 155 131 156 init_protocol(); … … 152 177 char buffer[128]; 153 178 while(!feof(stdin)) { 154 fgets(buffer, 128, stdin); 179 int ret = cfa_read(0, buffer, 128, 0, -1`s, 0p, 0p); 180 if(ret < 0) abort( "main read error: (%d) %s\n", (int)errno, strerror(errno) ); 155 181 } 156 182 … … 159 185 160 186 for(i; options.clopts.nworkers) { 161 printf("Cancelling %p\n", (void*)workers[i].cancel.target);162 187 workers[i].done = true; 163 188 cancel(workers[i].cancel);
Note: See TracChangeset
for help on using the changeset viewer.