PortAudio  2.0
Macros | Functions
patest_write_stop_hang_illegal.c File Reference
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <memory.h>
#include <pthread.h>
#include "portaudio.h"


#define SAMPLE_RATE   (44100)
#define FRAMES_PER_BUFFER   (2048)


void * stop_thread_proc (void *arg)
int main (void)

Macro Definition Documentation

#define FRAMES_PER_BUFFER   (2048)
#define SAMPLE_RATE   (44100)

Function Documentation

int main ( void  )
void* stop_thread_proc ( void *  arg)

WARNING: PortAudio is NOT thread safe. DO NOT call PortAudio from multiple threads without synchronization. This test uses PA in an ILLEGAL WAY in order to try to flush out potential hang bugs. The test calls Pa_WriteStream() and Pa_StopStream() simultaneously from separate threads in order to try to cause Pa_StopStream() to hang. In the main thread we write to the stream in a loop. Then try stopping PA from another thread to see if it hangs.

: Do not expect this test to pass. The test is only here as a debugging aid for hang bugs. Since this test uses PA in an illegal way, it may fail for reasons that are not PA bugs.

References Pa_GetStreamTime(), and Pa_StopStream().