From 51befb3fa7520de81739053cf9133fb4e2d90e12 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 16 Mar 2019 15:54:08 -0600 Subject: [PATCH] apps/examples/pwfb/pwfb_main.c: Temporarily work around a race condition by adding a delay. --- examples/pwfb/pwfb_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/pwfb/pwfb_main.c b/examples/pwfb/pwfb_main.c index e20c73bf5..0c5650ff4 100644 --- a/examples/pwfb/pwfb_main.c +++ b/examples/pwfb/pwfb_main.c @@ -396,6 +396,17 @@ static bool pwfb_configure_window(FAR struct pwfb_state_s *st, int wndx, goto errout_with_hwnd; } + /* There is a race condition which we resole by simply waiting a bit here: + * In order for the size and position to take effect, a command is sent to + * server which responds with an event. So we need to synchronize at this + * point, or the following fill will fail. + * + * REVISIT: Here a dumb wait is used. It be better to have a firm + * handshake to when the new size and position are in effect. + */ + + usleep(500 * 1000); + /* Create a bounding box. This is actually too large because it does not * account for the boarder widths. However, NX should clip the fill to * stay within the frame.