exit() -> _exit() in pcm_direct.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello.
My program call snd_pcm_open() with "plug:dmix" in thread. Function snd_pcm_direct_server_create() hangs on waitpid() if exit() is used, and server_job process keeps alive after program exit.
This trivial patch chages exit() to _exit() in file pcm_direct.c. In this case all works ok for me.
Best regards, Konstantin Stepaniuk.
pcm_direct.c renamed from pcm_direct.c.orig +2 -2
@@ -284,7 +284,7 @@snd_pcm_direct_shm_discard (dmix);snd_pcm_direct_semaphore_discard (dmix);server_printf ("DIRECT SERVER EXIT\n" ); -exit (EXIT_SUCCESS ); +_exit (EXIT_SUCCESS ); }int snd_pcm_direct_server_create (snd_pcm_direct_t *dmix)
@@ -316,7 +316,7 @@ ret =fork ();if (ret ==0 )server_job (dmix); -exit (EXIT_SUCCESS ); +_exit (EXIT_SUCCESS ); }else {waitpid (ret,NULL ,0 ); }
Quoted 7 lines · Konstantin Stepaniuk
Hello.
My program call
snd_pcm_open()with "plug:dmix" in thread. Functionsnd_pcm_direct_server_create()hangs onwaitpid()ifexit()is used, andserver_jobprocess keeps alive after program exit.
This trivial patch chagesexit()to_exit()in filepcm_direct.c. In this case all works ok for me.
I'm sorry, but I still don't see a reason (I'd like to know, why the process hangs). Could you explain the behaviour or send me a simple test code to debug this thing?
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Quoted 12 lines · Jaroslav Kysela
Quoted 7 lines · Konstantin Stepaniuk
Hello.
My program call
snd_pcm_open()with "plug:dmix" in thread.
Functionsnd_pcm_direct_server_create()hangs onwaitpid()ifexit()is used, andserver_jobprocess keeps alive after program exit. This trivial patch chagesexit()to_exit()in filepcm_direct.c. In this case all works ok for me.
Quoted 10 lines
I'm sorry, but I still don't see a reason (I'd like to know, why the process hangs). Could you explain the behaviour or send me a simple test code to debug this thing?
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
Here's a test:
/* dmix.c */
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
#include <pthread.h>
#include <stdio.h>
void *thread_routine( void *param )
{
snd_pcm_t *pcm;
int err;
err = snd_pcm_open( &pcm, "plug:dmix",
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK );
if( err < 0 )
{
fprintf( stderr, "%s\n", snd_strerror(err) );
return NULL;
}
printf( "alsa opened\n" );
snd_pcm_close( pcm );
return NULL;
}
int main( void )
{
pthread_t thread;
int i;
if( pthread_create( &thread, 0, thread_routine, NULL ) ) {
fprintf( stderr, "pthread_create failure\n" ); return -1;
}
pthread_join( thread, NULL );
return 0;
}
/*--------------------*/
This program crashes without any error message and doesn't print "alsa opened".
sound card: intel8x0
alsa version: cvs snapshot 2003-07-30
kernel version: 2.4.21 (Debian)
glibc: 2.3.1
This works ok with cmipci card. Maybe problem with intel8x0?
P.S. Add please '\n' in aplay version string :)
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
At Wed, 30 Jul 2003 23:21:52 +0400,
Quoted 76 lines · Konstantin Stepaniuk
Quoted 18 lines · Jaroslav Kysela
Quoted 9 lines · Konstantin Stepaniuk
Hello.
My program call
snd_pcm_open()with "plug:dmix" in thread. Functionsnd_pcm_direct_server_create()hangs onwaitpid()ifexit()is used, andserver_jobprocess keeps alive after program exit.
This trivial patch chagesexit()to_exit()in filepcm_direct.c. In this case all works ok for me.I'm sorry, but I still don't see a reason (I'd like to know, why the process hangs). Could you explain the behaviour or send me a simple test code to debug this thing?
Quoted 8 lines
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE LabsHere's a test:
/*dmix.c*/
#defineALSA_PCM_NEW_HW_PARAMS_API
#defineALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
#include <pthread.h>
#include <stdio.h>void *thread_routine( void *param )
{
snd_pcm_t*pcm;
int err;err = snd_pcm_open( &pcm, "plug:dmix",
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK );if( err < 0 ) { fprintf( stderr, "%s\n", snd_strerror(err) ); return NULL; } printf( "alsa opened\n" );
snd_pcm_close( pcm );
return NULL;
}int main( void )
{
pthread_tthread;
int i;if( pthread_create( &thread, 0, thread_routine, NULL ) ) { fprintf( stderr, "pthread_create failure\n" ); return -1; }
pthread_join( thread, NULL );
return 0;
}
/*--------------------*/This program crashes without any error message and doesn't print "alsa opened".
Quoted 6 lines
sound card: intel8x0
alsa version: cvs snapshot 2003-07-30
kernel version: 2.4.21 (Debian)
glibc: 2.3.1This works ok with cmipci card. Maybe problem with intel8x0?
seems working on other cards, too.
are the alsa-lib version on both systems really same?
Takashi
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Quoted 83 lines · Takashi Iwai
At Wed, 30 Jul 2003 23:21:52 +0400,
Quoted 81 lines · Konstantin Stepaniuk
Quoted 18 lines · Jaroslav Kysela
Quoted 9 lines · Konstantin Stepaniuk
Hello.
My program call
snd_pcm_open()with "plug:dmix" in thread. Functionsnd_pcm_direct_server_create()hangs onwaitpid()ifexit()is used, andserver_jobprocess keeps alive after program exit.
This trivial patch chagesexit()to_exit()in filepcm_direct.c. In this case all works ok for me.I'm sorry, but I still don't see a reason (I'd like to know, why the process hangs). Could you explain the behaviour or send me a simple test code to debug this thing?
Quoted 8 lines
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE LabsHere's a test:
/*dmix.c*/
#defineALSA_PCM_NEW_HW_PARAMS_API
#defineALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
#include <pthread.h>
#include <stdio.h>void *thread_routine( void *param )
{
snd_pcm_t*pcm;
int err;err = snd_pcm_open( &pcm, "plug:dmix",
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK );if( err < 0 ) { fprintf( stderr, "%s\n", snd_strerror(err) ); return NULL; } printf( "alsa opened\n" );
snd_pcm_close( pcm );
return NULL;
}int main( void )
{
pthread_tthread;
int i;if( pthread_create( &thread, 0, thread_routine, NULL ) ) { fprintf( stderr, "pthread_create failure\n" ); return -1; }
pthread_join( thread, NULL );
return 0;
}
/*--------------------*/This program crashes without any error message and doesn't print "alsa opened".
sound card: intel8x0
alsa version: cvs snapshot 2003-07-30
kernel version: 2.4.21 (Debian)
glibc: 2.3.1
Quoted 5 lines
Quoted 1 line
This works ok with cmipci card. Maybe problem with intel8x0?
seems working on other cards, too.
are the alsa-lib version on both systems really same?
And could you compare glibc versions?
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01