music_cmd.c
changeset 467 4b52401dda92
parent 447 50248d0ec654
child 518 8bc9b5fd2aae
equal deleted inserted replaced
466:d3d060cb94a6 467:4b52401dda92
    21 */
    21 */
    22 #include "SDL_config.h"
    22 #include "SDL_config.h"
    23 
    23 
    24 /* This file supports an external command for playing music */
    24 /* This file supports an external command for playing music */
    25 
    25 
    26 #if defined(unix) || defined(__MACOSX__) /* This is a UNIX-specific hack */
    26 #ifdef CMD_MUSIC
    27 
    27 
    28 #include <sys/types.h>
    28 #include <sys/types.h>
    29 #include <sys/wait.h>
    29 #include <sys/wait.h>
    30 #include <stdio.h>
    30 #include <stdio.h>
    31 #include <stdlib.h>
    31 #include <stdlib.h>
   141 }
   141 }
   142 
   142 
   143 /* Start playback of a given music stream */
   143 /* Start playback of a given music stream */
   144 void MusicCMD_Start(MusicCMD *music)
   144 void MusicCMD_Start(MusicCMD *music)
   145 {
   145 {
       
   146 #ifdef HAVE_FORK
   146 	music->pid = fork();
   147 	music->pid = fork();
       
   148 #else
       
   149 	music->pid = vfork();
       
   150 #endif
   147 	switch(music->pid) {
   151 	switch(music->pid) {
   148 	    /* Failed fork() system call */
   152 	    /* Failed fork() system call */
   149 	    case -1:
   153 	    case -1:
   150 		Mix_SetError("fork() failed");
   154 		Mix_SetError("fork() failed");
   151 		return;
   155 		return;
   233 		}
   237 		}
   234 	}
   238 	}
   235 	return(active);
   239 	return(active);
   236 }
   240 }
   237 
   241 
   238 #endif /* unix */
   242 #endif /* CMD_MUSIC */