日期:2014-05-16 浏览次数:20872 次
static void Play( pt_SongInfo Head )
{
pid_t pid;
pt_SongInfo temp = Head;
if (!Head)
{
printf("The Head list is empty \n");
exit(0);
}
temp = temp->prior;
while (1)
{
temp = temp->next;
pid = fork();
printf("####play function %d##### \n",getpid());
if (pid == 0)
{
pt_shareInfo shm_info = (pt_shareInfo)shmat(shmid, 0, 0);
if (shm_info == NULL)
{
printf("share memory get address error \n");
exit(0);
}
strcpy(shm_info->name,temp->name);
shm_info->grandson = getpid();
execlp("madplay","madplay","-a -50",temp->name,NULL);
printf("\n@@@@@@@@@@@@@@@@@@@@ NEXT SONG START @@@@@@@@@@@@@@@@@@@@\n");
}
else
{
wait(NULL);
}
}
}