diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-06-19 14:52:34 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-06-23 18:04:38 -0700 |
commit | 001c13da0690b9eb6d7d5642099479e63041fbec (patch) | |
tree | 6e6787dbbd62d8e965ab1638d1ffee3087e773d5 /recordmydesktop/src/rmd_initialize_data.c | |
parent | 1c4174855664744595541347afecfea1fb919b52 (diff) |
*: first attempt to unfuck thread synchronization
I'm already regretting this...
I don't think the author understood how condition variables work,
that signal/broadcast is purely synchronous with blocked waiters
- they don't queue a "signaled" state.
So all these cond_waits littered everywhere without any explicit
stateful condition being watched, if they didn't happen to be
sitting in the wait when the signal occurred, that signal event
was lost, and blocking would persist until the next one. Even if
the wait only *just* missed the arrival due to scheduling, it was
a very racy and broken use of condition variables.
Not to mention the possibility of spurious wakeups... You
*always* need some shared state to use condition variables
properly, it's why they include a mutex; to protect the shared
state. If you're not writing a while() loop to wait on a
condition variable, you're almost certainly doing it wrong.
This stuff will continue to evolve as I get around to it.
Diffstat (limited to 'recordmydesktop/src/rmd_initialize_data.c')
-rw-r--r-- | recordmydesktop/src/rmd_initialize_data.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/recordmydesktop/src/rmd_initialize_data.c b/recordmydesktop/src/rmd_initialize_data.c index 69f4fce..ecf708a 100644 --- a/recordmydesktop/src/rmd_initialize_data.c +++ b/recordmydesktop/src/rmd_initialize_data.c @@ -99,8 +99,8 @@ int rmdInitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data) pdata->pause_state_changed = FALSE; pdata->frames_total = 0; pdata->frames_lost = 0; - pdata->encoder_busy = FALSE; - pdata->capture_busy = FALSE; + pdata->capture_frameno = 0; + pdata->time_frameno = 0; if (!pdata->args.nosound) { if (!pdata->args.use_jack) { |