jack-compiler/misc/threads.h

26 lines
556 B
C
Raw Normal View History

2020-12-31 18:12:31 -05:00
#ifndef THREADS_H
#define THREADS_H
#include <pthread.h>
#include "parser.h"
#include "compiler.h"
#include "io.h"
/* threads
* Tools for dealing with the compiling pipeline in a parallel way */
typedef struct unit {
FILELIST* file;
2021-01-03 14:08:54 -05:00
PARSER* parser;
2020-12-31 18:12:31 -05:00
CLASS* parsed;
COMPILER* compiler;
LINEBLOCK* compiled;
struct unit* next;
} COMPILEUNIT;
void* parseunit(void* input);
void* compileunit(void* input);
void waitthreads(pthread_t* threads, int amount);
void actonunits(COMPILEUNIT* units, void*(*fun)(void*));
2021-01-03 14:08:54 -05:00
void freeunit(COMPILEUNIT* u);
2020-12-31 18:12:31 -05:00
#endif