-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.c
More file actions
49 lines (38 loc) · 831 Bytes
/
test.c
File metadata and controls
49 lines (38 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#if 1
#include <SDL2/SDL.h>
#endif
#define ABC_FIFO_IMPL
#include "ABC_fifo.h"
// Example program
typedef enum {
TASK_NOP,
TASK_PRINT,
TASK_LOAD_FILE
} TASK_TYPE;
int testTaskHandler(ABC_TASK* task) {
if (task->type == TASK_PRINT) {
printf("%s\n", task->data);
task->resultCode = 0;
// TODO: Push to SDL Event Queue
}
return 0;
}
int main(void) {
// Create the queue
ABC_FIFO queue;
ABC_FIFO_create(&queue);
queue.taskHandler = testTaskHandler;
ABC_TASK task = {0};
task.type = TASK_PRINT;
task.data = "Hello world";
uint64_t total = 0;
for (uint64_t i = 0; i < 16*1000; i++) {
ABC_FIFO_pushTask(&queue, task);
}
// SDL_Delay(20 /* seconds */ * 1000);
ABC_FIFO_waitForEmptyQueue(&queue);
ABC_FIFO_close(&queue);
}