player_control: hold lock while reading status

This commit is contained in:
Max Kellermann 2009-11-12 18:40:36 +01:00
parent 9947b82cad
commit b9866e43d3

View File

@ -176,7 +176,8 @@ pc_set_pause(bool pause_flag)
void void
pc_get_status(struct player_status *status) pc_get_status(struct player_status *status)
{ {
player_command(PLAYER_COMMAND_REFRESH); player_lock();
player_command_locked(PLAYER_COMMAND_REFRESH);
status->state = pc.state; status->state = pc.state;
@ -186,6 +187,8 @@ pc_get_status(struct player_status *status)
status->total_time = pc.total_time; status->total_time = pc.total_time;
status->elapsed_time = pc.elapsed_time; status->elapsed_time = pc.elapsed_time;
} }
player_unlock();
} }
enum player_state enum player_state