mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
util: thrd_err_as_string(): new function, returns a thrd_*() error string
This commit is contained in:
parent
1d1eb89925
commit
dd3f43d65c
1 changed files with 18 additions and 0 deletions
18
util.h
18
util.h
|
|
@ -1,5 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <threads.h>
|
||||
|
||||
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
|
||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
static inline const char *
|
||||
thrd_err_as_string(int thrd_err)
|
||||
{
|
||||
switch (thrd_err) {
|
||||
case thrd_success: return "success";
|
||||
case thrd_busy: return "busy";
|
||||
case thrd_nomem: return "no memory";
|
||||
case thrd_timedout: return "timedout";
|
||||
|
||||
case thrd_error:
|
||||
default: return "unknown error";
|
||||
}
|
||||
|
||||
return "unknown error";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue