summaryrefslogtreecommitdiff
path: root/lib/frr_pthread.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-08-30 08:00:25 +0200
committerGitHub <noreply@github.com>2018-08-30 08:00:25 +0200
commit53acd58416639a0d79dba7dac7ed7732e8f122e8 (patch)
treef36321071410a60a4df64d33bd19039421408f09 /lib/frr_pthread.h
parent2e7d2b93b6a6ecbc97f7e1e722c847a7f471afde (diff)
parent57019528a0279c3a6b2caa2100f5c6199ad378f2 (diff)
Merge pull request #2754 from chiragshah6/mdev1
*: pthread set name abstraction
Diffstat (limited to 'lib/frr_pthread.h')
-rw-r--r--lib/frr_pthread.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h
index 91002dd8ef..cc4fc74337 100644
--- a/lib/frr_pthread.h
+++ b/lib/frr_pthread.h
@@ -28,6 +28,8 @@
DECLARE_MTYPE(FRR_PTHREAD);
DECLARE_MTYPE(PTHREAD_PRIM);
+#define OS_THREAD_NAMELEN 16
+
struct frr_pthread;
struct frr_pthread_attr;
@@ -89,6 +91,9 @@ struct frr_pthread {
* Requires: mtx
*/
char *name;
+
+ /* Used in pthread_set_name max 16 characters */
+ char os_name[OS_THREAD_NAMELEN];
};
extern struct frr_pthread_attr frr_pthread_attr_default;
@@ -122,18 +127,23 @@ void frr_pthread_finish(void);
*
* @param attr - the thread attributes
* @param name - Human-readable name
+ * @param os_name - 16 characters (including '\0') thread name to set in os,
* @return the created frr_pthread upon success, or NULL upon failure
*/
struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr,
- const char *name);
+ const char *name, const char *os_name);
/*
* Changes the name of the frr_pthread.
*
* @param fpt - the frr_pthread to operate on
* @param name - Human-readable name
+ * @param os_name - 16 characters thread name , including the null
+ * terminator ('\0') to set in os.
+ * @return - on success returns 0 otherwise nonzero error number.
*/
-void frr_pthread_set_name(struct frr_pthread *fpt, const char *name);
+int frr_pthread_set_name(struct frr_pthread *fpt, const char *name,
+ const char *os_name);
/*
* Destroys an frr_pthread.