mirror of
https://github.com/0intro/libtask
synced 2024-11-24 22:59:43 +03:00
0609977c6e
print.c:106:10: warning: variable ‘neg’ set but not used tcpproxy.c:55:25: warning: cast to pointer from integer of different size tcpproxy.c:64:7: warning: cast from pointer to integer of different size testdelay.c:15:12: warning: cast from pointer to integer of different size testdelay.c:16:32: warning: cast from pointer to integer of different size testdelay.c:31:25: warning: cast to pointer from integer of different size
41 lines
613 B
C
41 lines
613 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <task.h>
|
|
|
|
enum { STACK = 32768 };
|
|
|
|
Channel *c;
|
|
|
|
void
|
|
delaytask(void *v)
|
|
{
|
|
taskdelay((int)(uintptr_t)v);
|
|
printf("awake after %d ms\n", (int)(uintptr_t)v);
|
|
chansendul(c, 0);
|
|
}
|
|
|
|
void
|
|
taskmain(int argc, char **argv)
|
|
{
|
|
int i, n;
|
|
|
|
c = chancreate(sizeof(unsigned long), 0);
|
|
|
|
n = 0;
|
|
for(i=1; i<argc; i++){
|
|
n++;
|
|
printf("x");
|
|
taskcreate(delaytask, (void*)(uintptr_t)atoi(argv[i]), STACK);
|
|
}
|
|
|
|
/* wait for n tasks to finish */
|
|
for(i=0; i<n; i++){
|
|
printf("y");
|
|
chanrecvul(c);
|
|
}
|
|
taskexitall(0);
|
|
}
|