Created
July 21, 2022 16:41
-
-
Save Frityet/3d25f28cbf7f7dbcda2d6dd95a52bd03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef pthread_t Thread_t; | |
| typedef void Job_f(size_t argc, void **argv); | |
| struct Promise { | |
| bool done; | |
| void *data; | |
| }; | |
| struct Job { | |
| struct Job *next; | |
| struct { | |
| size_t count; | |
| void **value; | |
| } arguments; | |
| size_t thread_id; | |
| struct Promise promise; | |
| Job_f *function; | |
| }; | |
| struct JobQueue { | |
| size_t count; | |
| struct Job *jobs; | |
| struct Job *top, *bottom; | |
| }; | |
| struct Company { | |
| struct { | |
| size_t count; | |
| Thread_t *threads; | |
| } workers; | |
| struct { | |
| size_t count; | |
| struct JobQueue *queues; | |
| } jobs; | |
| bool shouldrun; | |
| Thread_t workthread; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment