Example #1
0
DttSP_EXP void
process_samples_thread (unsigned int proc_thread)
{
	while (top[proc_thread].running)
	{
		sem_wait (&top[proc_thread].sync.buf.sem);
		do {
			gethold(proc_thread);
			sem_wait (&top[proc_thread].sync.upd.sem);
			switch (top[proc_thread].state)
			{
				case RUN_MUTE:
					run_mute (proc_thread);
					break;
				case RUN_PASS:
					run_pass (proc_thread);
					break;
				case RUN_PLAY:
					run_play (proc_thread);
					break;
				case RUN_SWCH:
					run_swch (proc_thread);
					break;
			}
			sem_post (&top[proc_thread].sync.upd.sem);
		} while (canhold (proc_thread));
    }
}
Example #2
0
int process_request(Server* server, Socket socket, char* msg, char* from_addr, int from_port){
    char command[10];

    sscanf(msg, "%s", command);

    if(!strcmp(command, "NICK")){
        run_nick(server, socket, msg, from_addr, from_port);
    }else if(!strcmp(command, "POST")){
        run_post(server, socket, msg, from_addr, from_port);
    }else if(!strcmp(command, "MUTE")){
        run_mute(server, socket, msg, from_addr, from_port);
    }else if(!strcmp(command, "UNMUTE")){
        run_unmute(server, socket, msg, from_addr, from_port);
    }else if(!strcmp(command, "CLOSE")){
        run_close(server, socket, msg, from_addr, from_port);
    }else{
        return -1;
    }
    return 0;
}