Subversion Repositories mdb

Rev

Rev 57 | Rev 59 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 57 Rev 58
Line 716... Line 716...
716
				nextCommand = PLAY_STACK;
716
				nextCommand = PLAY_STACK;
717
			}
717
			}
718
			else if (!playerActive)
718
			else if (!playerActive)
719
			{
719
			{
720
				int e;
720
				int e;
-
 
721
				pthread_attr_t attr;
-
 
722
 
-
 
723
				if (pthread_attr_init(&attr) != 0)
-
 
724
				{
-
 
725
					syslog(LOG_DAEMON,"Error getting thread attributes.");
-
 
726
					strcpy(cmd_error, "Error playing a file!");
-
 
727
					return FALSE;
-
 
728
				}
-
 
729
 
-
 
730
				if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0)
-
 
731
				{
-
 
732
					syslog(LOG_DAEMON,"Error setting thread attributes.");
-
 
733
					strcpy(cmd_error, "Error playing a file!");
-
 
734
					return FALSE;
-
 
735
				}
-
 
736
 
721
				/* start a new thread to play the file(s) */
737
				/* start a new thread to play the file(s) */
722
				if ((e = pthread_create(&pthr_play, NULL, pthr_playfile, (void *)&_playPars)) != 0)
738
				if ((e = pthread_create(&pthr_play, &attr, pthr_playfile, (void *)&_playPars)) != 0)
723
				{
739
				{
724
					switch (e)
740
					switch (e)
725
					{
741
					{
726
						case EAGAIN: strcpy (hv0, "Insufficient resources to create another thread."); break;
742
						case EAGAIN: strcpy (hv0, "Insufficient resources to create another thread."); break;
727
						case EINVAL: strcpy (hv0, "Invalid settings in \"attr\"."); break;
743
						case EINVAL: strcpy (hv0, "Invalid settings in \"attr\"."); break;
Line 749... Line 765...
749
			nextCommand = PLAY_PLAYPAUSE;
765
			nextCommand = PLAY_PLAYPAUSE;
750
		else if (playerActive && playStatus == PLAY_STATUS_STOP)
766
		else if (playerActive && playStatus == PLAY_STATUS_STOP)
751
			nextCommand = PLAY_PLAY;
767
			nextCommand = PLAY_PLAY;
752
		else if (!playerActive)
768
		else if (!playerActive)
753
		{
769
		{
-
 
770
			pthread_attr_t attr;
-
 
771
 
-
 
772
			if (pthread_attr_init(&attr) != 0)
-
 
773
			{
-
 
774
				syslog(LOG_DAEMON,"Error getting thread attributes.");
-
 
775
				strcpy(cmd_error, "Error playing a file!");
-
 
776
				return FALSE;
-
 
777
			}
-
 
778
 
-
 
779
			if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0)
-
 
780
			{
-
 
781
				syslog(LOG_DAEMON,"Error setting thread attributes.");
-
 
782
				strcpy(cmd_error, "Error playing a file!");
-
 
783
				return FALSE;
-
 
784
			}
-
 
785
 
754
			_playPars.s1 = s1;
786
			_playPars.s1 = s1;
755
			strcpy(_playPars.type, "QUEUE");					/* Select the queue to play. */
787
			strcpy(_playPars.type, "QUEUE");					/* Select the queue to play. */
756
			strcpy(_playPars.what, "0");						/* Play the first or a random file, if random is selected, in the queue. */
788
			strcpy(_playPars.what, "0");						/* Play the first or a random file, if random is selected, in the queue. */
757
			/* start a new thread to play the file(s) */
789
			/* start a new thread to play the file(s) */
758
			if (pthread_create(&pthr_play, NULL, pthr_playfile, (void *)&_playPars) != 0)
790
			if (pthread_create(&pthr_play, &attr, pthr_playfile, (void *)&_playPars) != 0)
759
			{
791
			{
760
				syslog (LOG_DAEMON,"Create of thread \"pthr_play\" failed!");
792
				syslog (LOG_DAEMON,"Create of thread \"pthr_play\" failed!");
761
				strcpy(cmd_error, "Error playing a file!");
793
				strcpy(cmd_error, "Error playing a file!");
762
				return FALSE;
794
				return FALSE;
763
			}
795
			}