All of lore.kernel.org
 help / color / mirror / Atom feed
* exit() -> _exit() in pcm_direct.c
       [not found] <E19d8Au-00060s-00@sc8-sf-list2.sourceforge.net>
@ 2003-07-30 16:21 ` Konstantin Stepaniuk
  2003-07-30 17:20   ` Jaroslav Kysela
  0 siblings, 1 reply; 6+ messages in thread
From: Konstantin Stepaniuk @ 2003-07-30 16:21 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

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.

[-- Attachment #2: pcm_direct.patch --]
[-- Type: text/x-diff, Size: 522 bytes --]

--- pcm_direct.c.orig	2003-07-30 20:01:34.000000000 +0400
+++ pcm_direct.c	2003-07-30 20:02:06.000000000 +0400
@@ -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);
 	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exit() -> _exit() in pcm_direct.c
  2003-07-30 16:21 ` exit() -> _exit() in pcm_direct.c Konstantin Stepaniuk
@ 2003-07-30 17:20   ` Jaroslav Kysela
  2003-07-30 19:21     ` Konstantin Stepaniuk
  0 siblings, 1 reply; 6+ messages in thread
From: Jaroslav Kysela @ 2003-07-30 17:20 UTC (permalink / raw)
  To: Konstantin Stepaniuk; +Cc: alsa-devel@lists.sourceforge.net

On Wed, 30 Jul 2003, Konstantin Stepaniuk wrote:

> 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.

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 <perex@suse.cz>
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exit() -> _exit() in pcm_direct.c
  2003-07-30 17:20   ` Jaroslav Kysela
@ 2003-07-30 19:21     ` Konstantin Stepaniuk
  2003-08-05 13:51       ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Konstantin Stepaniuk @ 2003-07-30 19:21 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

Jaroslav Kysela wrote:

>On Wed, 30 Jul 2003, Konstantin Stepaniuk wrote:
>
>  
>
>>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.
>>    
>>
>
>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 <perex@suse.cz>
>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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exit() -> _exit() in pcm_direct.c
  2003-07-30 19:21     ` Konstantin Stepaniuk
@ 2003-08-05 13:51       ` Takashi Iwai
  2003-08-05 18:36         ` Jaroslav Kysela
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2003-08-05 13:51 UTC (permalink / raw)
  To: Konstantin Stepaniuk; +Cc: Jaroslav Kysela, alsa-devel

At Wed, 30 Jul 2003 23:21:52 +0400,
Konstantin Stepaniuk wrote:
> 
> Jaroslav Kysela wrote:
> 
> >On Wed, 30 Jul 2003, Konstantin Stepaniuk wrote:
> >
> >  
> >
> >>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.
> >>    
> >>
> >
> >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 <perex@suse.cz>
> >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?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exit() -> _exit() in pcm_direct.c
  2003-08-05 13:51       ` Takashi Iwai
@ 2003-08-05 18:36         ` Jaroslav Kysela
  0 siblings, 0 replies; 6+ messages in thread
From: Jaroslav Kysela @ 2003-08-05 18:36 UTC (permalink / raw)
  To: Konstantin Stepaniuk; +Cc: alsa-devel@lists.sourceforge.net

On Tue, 5 Aug 2003, Takashi Iwai wrote:

> At Wed, 30 Jul 2003 23:21:52 +0400,
> Konstantin Stepaniuk wrote:
> > 
> > Jaroslav Kysela wrote:
> > 
> > >On Wed, 30 Jul 2003, Konstantin Stepaniuk wrote:
> > >
> > >  
> > >
> > >>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.
> > >>    
> > >>
> > >
> > >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 <perex@suse.cz>
> > >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?
> 
> 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 <perex@suse.cz>
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: exit() -> _exit() in pcm_direct.c
@ 2003-08-06 12:44 Konstantin Stepaniuk
  0 siblings, 0 replies; 6+ messages in thread
From: Konstantin Stepaniuk @ 2003-08-06 12:44 UTC (permalink / raw)
  To: alsa-devel

alsa-lib and glibc are same on both systems - alsa-lib from cvs, glibc from 
Debian unstable



-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-08-06 12:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E19d8Au-00060s-00@sc8-sf-list2.sourceforge.net>
2003-07-30 16:21 ` exit() -> _exit() in pcm_direct.c Konstantin Stepaniuk
2003-07-30 17:20   ` Jaroslav Kysela
2003-07-30 19:21     ` Konstantin Stepaniuk
2003-08-05 13:51       ` Takashi Iwai
2003-08-05 18:36         ` Jaroslav Kysela
2003-08-06 12:44 Konstantin Stepaniuk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.