mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-06 02:52:07 +08:00
mosquitto_loop_start() now sets a thread name.
This applies on Linux, FreeBSD, NetBSD, and OpenBSD. Closes #1777. Thanks to ABuch19.
This commit is contained in:
@@ -25,6 +25,8 @@ Client library:
|
||||
- Improved documentation around connect callback return codes. Close #1730.
|
||||
- Fix `mosquitto_publish*()` no longer returning `MOSQ_ERR_NO_CONN` when not
|
||||
connected. Closes #1725.
|
||||
- `mosquitto_loop_start()` now sets a thread name on Linux, FreeBSD, NetBSD,
|
||||
and OpenBSD. Closes #1777.
|
||||
|
||||
|
||||
1.6.10 - 2020-05-25
|
||||
|
||||
@@ -20,6 +20,12 @@ Contributors:
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__NetBSD__)
|
||||
# include <pthread.h>
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
# include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
#include "mosquitto_internal.h"
|
||||
#include "net_mosq.h"
|
||||
#include "util_mosq.h"
|
||||
@@ -33,6 +39,13 @@ int mosquitto_loop_start(struct mosquitto *mosq)
|
||||
|
||||
mosq->threaded = mosq_ts_self;
|
||||
if(!pthread_create(&mosq->thread_id, NULL, mosquitto__thread_main, mosq)){
|
||||
#if defined(__linux__)
|
||||
pthread_setname_np(mosq->thread_id, "mosquitto loop");
|
||||
#elif defined(__NetBSD__)
|
||||
pthread_setname_np(mosq->thread_id, "%s", "mosquitto loop");
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
pthread_set_name_np(mosq->thread_id, "mosquitto loop");
|
||||
#endif
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else{
|
||||
return MOSQ_ERR_ERRNO;
|
||||
|
||||
Reference in New Issue
Block a user