On Mon, 14 Apr 2008, Rong-Jhe wrote: > Rong-Jhe <r93922118 <at> ntu.edu.tw> writes: > > > > > I found that the thread server_job() can not be killed by using snd_pcm_close > > (). > > The code in snd_pcm_direct_server_discard() is disabled, and then it can not > > send signal to kill the thread. > > Why the code is disabled? > > Is there any bugs if I enable the code? > > > > I have enabled the code in snd_pcm_direct_server_discard(), but it can not > kill the thread of server_job(). The dmix->server_pid is wrong. > In snd_pcm_direct_server_create(), the main thread uses fork() to establish a > child thread and the child uses fork() to establish another child thread again. > The main thread only keeps the pid of the first child thread, and the second > child thread executes server_job(). Do to this, the main thread kills wrong > pid. > Further, the main thread uses waitpid() before keeping the pid of the first > child thread, and the first child thread dies after establishing the second > child thread. In this way, the pid kept in dmix->server_pid is useless. > Why does the program need to use fork() two times? What you're trying to do? The server process will timeout (ends) itself when dmix clients are inactive. Jaroslav ----- Jaroslav Kysela <perex@xxxxxxxx> Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel