ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/util/thread.h
Go to the documentation of this file.
1
51#pragma once
52
53#include <string.h>
54#include "../platform/abstraction.h"
55
62#define THREAD_IS_CREATED(created_flag) ((created_flag) == true)
63
76#define THREAD_CREATE_SAFE(thread_var, func, arg) asciichat_thread_create(&(thread_var), (func), (arg))
77
97#define THREAD_CREATE_OR_RETURN_VOID(thread_var, func, arg, error_msg) \
98 do { \
99 if (asciichat_thread_create(&(thread_var), (func), (arg)) != 0) { \
100 log_error("%s", (error_msg)); \
101 return; \
102 } \
103 } while (0)
104
119#define THREAD_JOIN_SAFE(thread_var, exit_code) asciichat_thread_join(&(thread_var), (exit_code))
120
132#define THREAD_JOIN(thread_var) asciichat_thread_join(&(thread_var), NULL)
133
145#define THREAD_CLEAR_HANDLE(thread_var) memset(&(thread_var), 0, sizeof(thread_var))
🔤 String Manipulation and Shell Escaping Utilities