begin theory

master
Avril 3 years ago
parent 411962b35f
commit accdc43602
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -10,6 +10,9 @@
#define BUFFER_SIZE 4096
#define IGNORE(param) do { (void)(param); } while(0)
//TODO: For explicitly threaded version: Make a lazy thread spawner, spawning up to 8 threads which will each work on a byte and atomically write back to a central array of `uint64_t [num_of_bytes / num_of_threads]`.
//TODO: But how to sync the fwrites of this buffer? An atomic counter of which threads have completed their operations, and a condvar that allows the controlling thread to check if the counter is full before `fwrite_all()`ing the array, resetting the counter, and carrying on
static inline int sfread(void* out, size_t *restrict size, FILE* f)
{
return !!(*size = (size_t)fread(out, 1, *size, f));

Loading…
Cancel
Save