diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-04-11 23:07:43 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-04-11 23:07:43 +0000 |
commit | ae33b348afa800447db9344cf6e5d082f1a1fcb3 (patch) | |
tree | 6e0977b81c8f9413a5513d27bd3a53cccabcf950 /src/playlist.c | |
parent | 063affb04775fcf59e92df0bf70f0ecec0edf4ed (diff) |
clean up signal handling using a polling method, from the genius that is mackstann
git-svn-id: https://svn.musicpd.org/mpd/trunk@697 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/playlist.c b/src/playlist.c index 1985612a1..471c1b08e 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -102,8 +102,6 @@ void initPlaylist() { playlist.random = 0; playlist.queued = -1; - blockTermSignal(); - playlist_max_length = strtol((getConf())[CONF_MAX_PLAYLIST_LENGTH],&test,10); if(*test!='\0') { ERROR("max playlist length \"%s\" is not an integer\n", @@ -137,7 +135,6 @@ void initPlaylist() { playlist_stateFile = getConf()[CONF_STATE_FILE]; } - unblockTermSignal(); } void finishPlaylist() { @@ -152,10 +149,8 @@ int clearPlaylist(FILE * fp) { if(stopPlaylist(fp)<0) return -1; - blockTermSignal(); for(i=0;i<playlist.length;i++) playlist.songs[i] = NULL; playlist.length = 0; - unblockTermSignal(); incrPlaylistVersion(); @@ -176,7 +171,6 @@ void savePlaylistState() { if(playlist_stateFile) { FILE * fp; - blockTermSignal(); while(!(fp = fopen(playlist_stateFile,"w")) && errno==EINTR); if(!fp) { ERROR("problems opening state file \"%s\" for " @@ -216,7 +210,6 @@ void savePlaylistState() { myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_PLAYLIST_END); while(fclose(fp) && errno==EINTR); - unblockTermSignal(); } } @@ -518,7 +511,6 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) { return -1; } - blockTermSignal(); if(playlist_state==PLAYLIST_STATE_PLAY) { if(playlist.queued>=0) { @@ -552,8 +544,6 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) { else if(playlist.current==song2) playlist.current = song1; } - unblockTermSignal(); - incrPlaylistVersion(); return 0; @@ -572,7 +562,6 @@ int deleteFromPlaylist(FILE * fp, int song) { return -1; } - blockTermSignal(); if(playlist_state==PLAYLIST_STATE_PLAY) { if(playlist.queued>=0 && (playlist.order[playlist.queued]==song || playlist.order[playlist.current]==song)) @@ -602,8 +591,6 @@ int deleteFromPlaylist(FILE * fp, int song) { playlist.songs[playlist.length-1] = NULL; playlist.length--; - unblockTermSignal(); - incrPlaylistVersion(); if(playlist_state!=PLAYLIST_STATE_STOP && playlist.current==songOrder) { @@ -820,7 +807,6 @@ int moveSongInPlaylist(FILE * fp, int from, int to) { return -1; } - blockTermSignal(); if(playlist_state==PLAYLIST_STATE_PLAY) { if(playlist.queued>=0) { @@ -866,8 +852,6 @@ int moveSongInPlaylist(FILE * fp, int from, int to) { playlist.current++; } - unblockTermSignal(); - incrPlaylistVersion(); return 0; @@ -878,7 +862,6 @@ void orderPlaylist() { playlist.current = playlist.order[playlist.current]; - blockTermSignal(); if(playlist_state==PLAYLIST_STATE_PLAY) { if(playlist.queued>=0) { lockPlaylistInteraction(); @@ -891,7 +874,6 @@ void orderPlaylist() { playlist.order[i] = i; } - unblockTermSignal(); } void swapOrder(int a, int b) { @@ -906,8 +888,6 @@ void randomizeOrder(int start,int end) { DEBUG("playlist: randomize from %i to %i\n",start,end); - blockTermSignal(); - if(playlist_state==PLAYLIST_STATE_PLAY) { if(playlist.queued>=start && playlist.queued<=end) { lockPlaylistInteraction(); @@ -923,7 +903,6 @@ void randomizeOrder(int start,int end) { swapOrder(i,ri); } - unblockTermSignal(); } int setPlaylistRandomStatus(FILE * fp, int status) { @@ -978,7 +957,6 @@ int shufflePlaylist(FILE * fp) { int ri; if(playlist.length>1) { - blockTermSignal(); if(playlist_state==PLAYLIST_STATE_PLAY) { lockPlaylistInteraction(); clearPlayerQueue(); @@ -999,7 +977,6 @@ int shufflePlaylist(FILE * fp) { ri = rand()%(playlist.length-1)+1; swapSongs(i,ri); } - unblockTermSignal(); incrPlaylistVersion(); } @@ -1068,7 +1045,6 @@ int savePlaylist(FILE * fp, char * utf8file) { return -1; } - while(!(fileP = fopen(actualFile,"w")) && errno==EINTR); if(fileP==NULL) { myfprintf(fp,"%s Problems opening file\n",COMMAND_RESPOND_ERROR); |