Project

General

Profile

audacious-plugins-3.9.patch

Add error handling of pthread_create in audacious-plugins - Zhouyang Jia, February 27, 2018 08:47

View differences:

src/neon/neon.cc
21 21
#include <inttypes.h>
22 22
#include <pthread.h>
23 23
#include <stdint.h>
24
#include <errno.h>
24 25
#include <string.h>
25 26

  
26 27
#include <glib.h>
......
789 790
            {
790 791
                m_reader_status.reading = true;
791 792
                AUDDBG ("<%p> Starting reader thread\n", this);
792
                pthread_create (& m_reader, nullptr, reader_thread, this);
793
                if (pthread_create (& m_reader, nullptr, reader_thread, this) != 0)
794
                {
795
                    AUDERR ("Can not create thread: %s!\n", strerror(errno));
796
                    return 0;
797
                }
793 798
                m_reader_status.status = NEON_READER_RUN;
794 799
            }
795 800
            else if (ret == FILL_BUFFER_EOF)
src/scrobbler2/scrobbler.cc
8 8
 */
9 9

  
10 10
#include <glib/gstdio.h>
11
#include <errno.h>
12
#include <string.h>
11 13

  
12 14
//audacious includes
13 15
#include <libaudcore/audstrings.h>
......
15 17
#include <libaudcore/hook.h>
16 18
#include <libaudcore/interface.h>
17 19
#include <libaudcore/plugin.h>
18

  
20
#include <libaudcore/runtime.h>
19 21

  
20 22
//plugin includes
21 23
#include "scrobbler.h"
......
251 253
      }
252 254
    }
253 255

  
254
    pthread_create(&communicator, nullptr, scrobbling_thread, nullptr);
256
    if (pthread_create(&communicator, nullptr, scrobbling_thread, nullptr) != 0) {
257
        AUDERR ("Can not create thread: %s!\n", strerror(errno));
258
        return false;
259
    }
255 260

  
256 261
    hook_associate("playback stop", (HookFunction) stopped, nullptr);
257 262
    hook_associate("playback end", (HookFunction) ended, nullptr);