diff options
author | Petri Hintukainen <phintuka@users.sourceforge.net> | 2012-02-27 10:05:05 +0200 |
---|---|---|
committer | Petri Hintukainen <phintuka@users.sourceforge.net> | 2012-02-27 10:05:05 +0200 |
commit | 47b02c9e06279a287a06a06c8fd9711eada75d80 (patch) | |
tree | 17f422b6b2dcd8aeb2b729900bb3c7bf5def4c4c /src | |
parent | 8ceb8edfad3971f93381a230f08ebde1aacae377 (diff) | |
download | xine-lib-47b02c9e06279a287a06a06c8fd9711eada75d80.tar.gz xine-lib-47b02c9e06279a287a06a06c8fd9711eada75d80.tar.bz2 |
Fixed race in metronom_get_option(): reading int64 is not atomic in 32-bit systems
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-engine/metronom.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 8cd36f70f..5f7a60631 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -745,23 +745,41 @@ static void metronom_clock_set_option (metronom_clock_t *this, static int64_t metronom_get_option (metronom_t *this, int option) { - if (this->master) - return this->master->get_option(this->master, option); + int64_t result; + + pthread_mutex_lock (&this->lock); + + if (this->master) { + result = this->master->get_option(this->master, option); + pthread_mutex_unlock (&this->lock); + return result; + } switch (option) { case METRONOM_AV_OFFSET: - return this->av_offset; + result = this->av_offset; + break; case METRONOM_SPU_OFFSET: - return this->spu_offset; + result = this->spu_offset; + break; case METRONOM_FRAME_DURATION: - return this->img_duration; + result = this->img_duration; + break; case METRONOM_VPTS_OFFSET: - return this->vpts_offset; + result = this->vpts_offset; + break; case METRONOM_PREBUFFER: - return this->prebuffer; + result = this->prebuffer; + break; + default: + result = 0; + xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option); + break; } - xprintf(this->xine, XINE_VERBOSITY_NONE, "unknown option in get_option: %d\n", option); - return 0; + + pthread_mutex_unlock (&this->lock); + + return result; } static int64_t metronom_clock_get_option (metronom_clock_t *this, int option) { |