jackc/misc/threads.h

30 lines
665 B
C
Raw Permalink Normal View History

2021-01-04 15:00:48 -05:00
#ifndef THREADS_H
#define THREADS_H
#include <pthread.h>
#include "parser.h"
#include "compiler.h"
#include "io.h"
#include "vm-translator.h"
/* threads
* Tools for dealing with the compiling pipeline in a parallel way */
typedef struct unit {
FILELIST* file;
PARSER* parser;
CLASS* parsed;
COMPILER* compiler;
2021-01-05 11:00:23 -05:00
ASMBLK* asmlns;
2021-01-04 15:00:48 -05:00
LINEBLOCK* compiled;
VMTRANSLATOR* vmtranslator;
struct unit* next;
} COMPILEUNIT;
void* parseunit(void* input);
void* compileunit(void* input);
void* vmtranslateunit(void* input);
void waitthreads(pthread_t* threads, int amount);
void actonunits(COMPILEUNIT* units, void*(*fun)(void*));
void freeunit(COMPILEUNIT* u);
#endif