Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 78fabcd781 |
@@ -400,10 +400,10 @@ static int scan_directory_multithreaded(void* pipeline_context) {
|
||||
}
|
||||
mtx_unlock(&context->mutex_scanner);
|
||||
}
|
||||
if (!queue_enqueue_multithreaded_cancel(context->queue_scanner, current_chunk, &context->mutex_scanner,
|
||||
&context->condition_not_empty_scanner,
|
||||
&context->condition_not_full_scanner,
|
||||
&context->cancelled)) {
|
||||
if (!queue_enqueue_multithreaded_cancel(
|
||||
context->queue_scanner, current_chunk, &context->mutex_scanner,
|
||||
&context->condition_not_empty_scanner, &context->condition_not_full_scanner,
|
||||
&context->cancelled)) {
|
||||
chunk_destroy(current_chunk);
|
||||
context->cancelled = true;
|
||||
cnd_broadcast(&context->condition_not_full_scanner);
|
||||
|
||||
+3
-4
@@ -18,16 +18,15 @@ void log_set_file(FILE* fp) {
|
||||
void log_message(LogLevel log_level, const char* format, ...) {
|
||||
if (log_level < current_log_level)
|
||||
return;
|
||||
if (log_level < 0 ||
|
||||
log_level >= (int)(sizeof(log_level_strings) / sizeof(log_level_strings[0])))
|
||||
if (log_level < 0 || log_level >= (int)(sizeof(log_level_strings) / sizeof(log_level_strings[0])))
|
||||
return;
|
||||
time_t now = time(NULL);
|
||||
struct tm t;
|
||||
if (!localtime_r(&now, &t))
|
||||
return;
|
||||
|
||||
fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t.tm_year + 1900, t.tm_mon + 1,
|
||||
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, log_level_strings[log_level]);
|
||||
fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday,
|
||||
t.tm_hour, t.tm_min, t.tm_sec, log_level_strings[log_level]);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
@@ -139,8 +139,8 @@ static bool receive_chunk_enqueue(int file_descriptor, PipelineContextReceiver*
|
||||
File* file = chunk->items[i];
|
||||
chunk->items[i] = NULL;
|
||||
if (!queue_enqueue_multithreaded_cancel(context->queue, file, &context->mutex,
|
||||
&context->condition_not_empty, &context->condition_not_full,
|
||||
&context->cancelled)) {
|
||||
&context->condition_not_empty,
|
||||
&context->condition_not_full, &context->cancelled)) {
|
||||
file_destroy(file);
|
||||
chunk_destroy(chunk);
|
||||
return false;
|
||||
@@ -178,9 +178,9 @@ int receive_thread(void* pipeline_context) {
|
||||
if (!skipped) {
|
||||
if (file == NULL)
|
||||
return thrd_error;
|
||||
if (!queue_enqueue_multithreaded_cancel(context->queue, file, &context->mutex,
|
||||
&context->condition_not_empty, &context->condition_not_full,
|
||||
&context->cancelled)) {
|
||||
if (!queue_enqueue_multithreaded_cancel(
|
||||
context->queue, file, &context->mutex, &context->condition_not_empty,
|
||||
&context->condition_not_full, &context->cancelled)) {
|
||||
file_destroy(file);
|
||||
return thrd_error;
|
||||
}
|
||||
@@ -219,9 +219,9 @@ int receive_thread(void* pipeline_context) {
|
||||
} else {
|
||||
File* file = file_receive(config, file_descriptor);
|
||||
if (file) {
|
||||
if (!queue_enqueue_multithreaded_cancel(context->queue, file, &context->mutex,
|
||||
&context->condition_not_empty, &context->condition_not_full,
|
||||
&context->cancelled)) {
|
||||
if (!queue_enqueue_multithreaded_cancel(
|
||||
context->queue, file, &context->mutex, &context->condition_not_empty,
|
||||
&context->condition_not_full, &context->cancelled)) {
|
||||
file_destroy(file);
|
||||
return thrd_error;
|
||||
}
|
||||
|
||||
+2
-1
@@ -74,7 +74,8 @@ char* str_dup(const char* string) {
|
||||
* ? matches any single character except '/'.
|
||||
* * matches any sequence of characters within one path component (no '/').
|
||||
* ** matches any sequence of characters, including '/' (cross-directory).
|
||||
* slash-star-star-slash is treated as a cross-directory wildcard when it appears between literals.
|
||||
* slash-star-star-slash is treated as a cross-directory wildcard when it appears between
|
||||
* literals.
|
||||
*/
|
||||
bool glob_match(const char* pattern, const char* str) {
|
||||
while (*pattern) {
|
||||
|
||||
Reference in New Issue
Block a user