diff options
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-x | channels/chan_iax2.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 04f80738f..c9da32ea9 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -172,7 +172,7 @@ static char accountcode[20]; static int amaflags = 0; static int notransfer = 0; -static pthread_t netthreadid; +static pthread_t netthreadid = AST_PTHREADT_NULL; #define IAX_STATE_STARTED (1 << 0) #define IAX_STATE_AUTHENTICATED (1 << 1) @@ -6521,8 +6521,10 @@ static int __unload_module(void) { int x; /* Cancel the network thread, close the net socket */ - pthread_cancel(netthreadid); - pthread_join(netthreadid, NULL); + if (netthreadid != AST_PTHREADT_NULL) { + pthread_cancel(netthreadid); + pthread_join(netthreadid, NULL); + } close(netsocket); for (x=0;x<IAX_MAX_CALLS;x++) if (iaxs[x]) |