scheduler.c

Basic task scheduling library
git clone git://git.finwo.net/lib/scheduler.c
Log | Files | Refs | README | LICENSE

README.md (1307B)


      1 # Examples
      2 
      3 Each file is a complete, compilable C program demonstrating a specific aspect of the scheduler.
      4 
      5 ## Building
      6 
      7 From the repository root:
      8 
      9 ```sh
     10 make -C examples
     11 ```
     12 
     13 Or compile a single example manually:
     14 
     15 ```sh
     16 gcc -o greet examples/example_basic.c src/scheduler.c
     17 ```
     18 
     19 All examples are self-contained and require only `src/scheduler.h`, `src/scheduler.c`, and the C standard library.
     20 
     21 ## Index
     22 
     23 | File | Description |
     24 |------|-------------|
     25 | [example_basic.c](example_basic.c) | Minimal one-shot task — runs once and exits |
     26 | [example_periodic.c](example_periodic.c) | Periodic task using timestamps to run every second |
     27 | [example_io.c](example_io.c) | I/O monitoring on a pipe; waits for data to be readable |
     28 | [example_removal.c](example_removal.c) | Parent task spawns a child task, then removes it after a delay |
     29 | [example_multi.c](example_multi.c) | Multiple tasks sharing a context; coordinated shutdown |
     30 
     31 ## Running
     32 
     33 ```sh
     34 ./example_basic      # Prints "Hello, world!" and exits immediately
     35 ./example_periodic   # Prints a timestamp every second, exits after 5s
     36 ./example_io         # Reads from a pipe and prints each line
     37 ./example_removal    # Prints tick counts from two tasks; parent kills child
     38 ./example_multi       # Reader and writer tasks share a buffer via udata
     39 ```