Project

General

Profile

0001-Detect-pump_stop-deadlock.patch

Igor Kushnir, April 20, 2020 15:02

View differences:

src/alsa/alsa.cc
161 161

  
162 162
        if (alsa_prebuffer || alsa_paused || ! writable)
163 163
        {
164
            fprintf(stderr, "start waiting\n");
164 165
            pthread_cond_wait (& alsa_cond, & alsa_mutex);
166
            fprintf(stderr, "end waiting\n");
165 167
            continue;
166 168
        }
167 169

  
......
232 234
    AUDDBG ("Stopping pump.\n");
233 235
    pump_quit = true;
234 236
    pthread_cond_broadcast (& alsa_cond);
237
    fprintf(stderr, "broadcasted\n");
235 238
    poll_wake ();
236 239
    pthread_mutex_unlock (& alsa_mutex);
237 240
    pthread_join (pump_thread, nullptr);
238 241
    pthread_mutex_lock (& alsa_mutex);
242
    fprintf(stderr, "joined\n");
239 243
    pump_quit = false;
240 244
}
241 245

  
......
399 403
    pthread_mutex_lock (& alsa_mutex);
400 404

  
401 405
    assert (alsa_handle);
402

  
406
    fprintf(stderr, "close_audio()\n");
403 407
    pump_stop ();
408
    fprintf(stderr, "--close_audio()\n");
404 409
    CHECK (snd_pcm_drop, alsa_handle);
405 410

  
406 411
FAILED:
......
462 467

  
463 468
    while (snd_pcm_bytes_to_frames (alsa_handle, alsa_buffer.len ()))
464 469
        pthread_cond_wait (& alsa_cond, & alsa_mutex);
465

  
470
    fprintf(stderr, "drain()\n");
466 471
    pump_stop ();
472
    fprintf(stderr, "--drain()\n");
467 473

  
468 474
    if (! alsa_prebuffer)
469 475
    {
......
508 514
{
509 515
    AUDDBG ("Seek requested; discarding buffer.\n");
510 516
    pthread_mutex_lock (& alsa_mutex);
511

  
517
    fprintf(stderr, "flush()\n");
512 518
    pump_stop ();
519
    fprintf(stderr, "--flush()\n");
513 520
    CHECK (snd_pcm_drop, alsa_handle);
514 521

  
515 522
FAILED:
516
-