BitLab 0.1.0
BitLab: A Browser for the Bitcoin P2P Network and Blockchain
Loading...
Searching...
No Matches
thread.c
Go to the documentation of this file.
1#include "thread.h"
2
3#include <pthread.h>
4#include <errno.h>
5#include <string.h>
6
7#include "utils.h"
8
9pthread_t thread_runner(void* (*start_routine)(void*), const char* name, void* arg)
10{
11 pthread_t thread;
12 if (pthread_create(&thread, NULL, start_routine, arg) != 0)
13 log_message(LOG_WARN, BITLAB_LOG, __FILE__, "%s thread creation failed: %s", name, strerror(errno));
14 log_message(LOG_INFO, BITLAB_LOG, __FILE__, "%s thread started", name);
15 return thread;
16}
void log_message(log_level level, const char *filename, const char *source_file, const char *format,...)
Log a message used to log a message to the console or a file.
Definition log.c:89
#define BITLAB_LOG
Definition log.h:11
@ LOG_INFO
Definition log.h:30
@ LOG_WARN
Definition log.h:31
pthread_t thread_runner(void *(*start_routine)(void *), const char *name, void *arg)
Thread runner function.
Definition thread.c:9