ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
thread.c
Go to the documentation of this file.
1
10#include <ascii-chat/platform/thread.h>
11#include <ascii-chat/common.h>
12#include <ascii-chat/log/logging.h>
13
14asciichat_error_t thread_create_or_fail(asciichat_thread_t *thread, void *(*func)(void *), void *arg,
15 const char *thread_name, uint32_t client_id) {
16 if (!thread || !func || !thread_name) {
17 return SET_ERRNO(ERROR_INVALID_PARAM, "Invalid parameters for thread creation");
18 }
19
20 int result = asciichat_thread_create(thread, func, arg);
21 if (result != 0) {
22 return SET_ERRNO(ERROR_PLATFORM_INIT, "Failed to create %s thread for client %u (result=%d)", thread_name,
23 client_id, result);
24 }
25
26 log_debug("Created %s thread for client %u successfully", thread_name, client_id);
27 return ASCIICHAT_OK;
28}
asciichat_error_t thread_create_or_fail(asciichat_thread_t *thread, void *(*func)(void *), void *arg, const char *thread_name, uint32_t client_id)
Definition thread.c:14
int asciichat_thread_create(asciichat_thread_t *thread, void *(*start_routine)(void *), void *arg)
Definition threading.c:42