🐛
This commit is contained in:
BIN
A2/fhistogram-mt
BIN
A2/fhistogram-mt
Binary file not shown.
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "job_queue.h"
|
||||
|
||||
pthread_mutex_t stdout_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
// err.h contains various nonstandard BSD extensions, but they are
|
||||
// very handy.
|
||||
@@ -26,7 +26,12 @@ int global_histogram[8] = { 0 };
|
||||
|
||||
struct job_queue q;
|
||||
|
||||
|
||||
void update_histogram_mt(int local_histogram[8]) {
|
||||
pthread_mutex_lock(&mutex);
|
||||
merge_histogram(local_histogram, global_histogram);
|
||||
print_histogram(global_histogram);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
int fhistogram_mt(char const *path) {
|
||||
FILE *f = fopen(path, "r");
|
||||
|
||||
BIN
A2/src.zip
BIN
A2/src.zip
Binary file not shown.
Reference in New Issue
Block a user