DJWLindenaar balanced tree and master process patch

git-svn-id: https://svn.musicpd.org/mpd/trunk@3669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Qball Cow
2005-11-16 14:43:04 +00:00
parent 402c8cd707
commit 32e5f4ca2b
13 changed files with 291 additions and 118 deletions

View File

@@ -34,6 +34,7 @@ int buffered_chunks;
#define DEFAULT_BUFFER_BEFORE_PLAY 0
PlayerData * playerData_pd;
int * player_pid;
void initPlayerData() {
float perc = DEFAULT_BUFFER_BEFORE_PLAY;
@@ -102,6 +103,22 @@ void initPlayerData() {
ERROR("problems shmctl'ing\n");
exit(EXIT_FAILURE);
}
/* maybe the following should be put in the same shm block as the previous
* or maybe even made a part of the playerData struct
*/
allocationSize = sizeof(int);
if((shmid = shmget(IPC_PRIVATE,allocationSize,IPC_CREAT|0600))<0) {
ERROR("problems shmget'ing\n");
exit(EXIT_FAILURE);
}
if((player_pid = shmat(shmid,NULL,0))<0) {
ERROR("problems shmat'ing\n");
exit(EXIT_FAILURE);
}
if (shmctl(shmid, IPC_RMID, 0)<0) {
ERROR("problems shmctl'ing\n");
exit(EXIT_FAILURE);
}
buffer = &(playerData_pd->buffer);
@@ -147,6 +164,15 @@ PlayerData * getPlayerData() {
return playerData_pd;
}
int getPlayerPid() {
return *player_pid;
}
void setPlayerPid(int pid) {
*player_pid = pid;
}
void freePlayerData() {
shmdt(playerData_pd);
shmdt(player_pid);
}