Skip to content

Commit

Permalink
Fix mosquitto_loop_stop() not stopping on Windows
Browse files Browse the repository at this point in the history
Closes #1748. Closes #117. Thanks to Sigmund Vik.
  • Loading branch information
ralight committed Aug 11, 2020
1 parent 3eb60e2 commit 4ef4826
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Expand Up @@ -27,6 +27,7 @@ Client library:
connected. Closes #1725.
- `mosquitto_loop_start()` now sets a thread name on Linux, FreeBSD, NetBSD,
and OpenBSD. Closes #1777.
- Fix `mosquitto_loop_stop()` not stopping on Windows. Closes #1748. Closes #117.


1.6.10 - 2020-05-25
Expand Down
1 change: 1 addition & 0 deletions lib/dummypthread.h
Expand Up @@ -4,6 +4,7 @@
#define pthread_create(A, B, C, D)
#define pthread_join(A, B)
#define pthread_cancel(A)
#define pthread_testcancel()

#define pthread_mutex_init(A, B)
#define pthread_mutex_destroy(A)
Expand Down
2 changes: 2 additions & 0 deletions lib/loop.c
Expand Up @@ -256,6 +256,7 @@ int mosquitto_loop_forever(struct mosquitto *mosq, int timeout, int max_packets)

while(run){
do{
pthread_testcancel();
rc = mosquitto_loop(mosq, timeout, max_packets);
}while(run && rc == MOSQ_ERR_SUCCESS);
/* Quit after fatal errors. */
Expand All @@ -280,6 +281,7 @@ int mosquitto_loop_forever(struct mosquitto *mosq, int timeout, int max_packets)
return rc;
}
do{
pthread_testcancel();
rc = MOSQ_ERR_SUCCESS;
state = mosquitto__get_state(mosq);
if(state == mosq_cs_disconnecting || state == mosq_cs_disconnected){
Expand Down

0 comments on commit 4ef4826

Please sign in to comment.