Change return type of `remove_thread()` to void

Flowing off the end of a function is undefined behavior. On Fedora 28,
the `nmux` program would segfault when this function returned.
pull/36/head
Bradford D. Boyle 2018-06-10 22:28:22 -07:00
rodzic f565d2a4bf
commit 594e9de349
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ tsmthread_t* tsmpool::register_thread()
return thread;
}
int tsmpool::remove_thread(tsmthread_t* thread)
void tsmpool::remove_thread(tsmthread_t* thread)
{
pthread_mutex_lock(&this->mutex);
for(int i=0;i<threads.size();i++)

Wyświetl plik

@ -36,7 +36,7 @@ public:
tsmpool(size_t size, int num);
void* get_write_buffer();
tsmthread_t* register_thread();
int remove_thread(tsmthread_t* thread);
void remove_thread(tsmthread_t* thread);
void* get_read_buffer(tsmthread_t* thread);
int index_next(int index) { return (index+1==num)?0:index+1; }
int index_before(int index) { return (index-1<0)?num-1:index-1; }