diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-23 20:23:51 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-24 10:44:04 +0100 |
commit | f02ba09475b751fba411addb96718dbcb1de5132 (patch) | |
tree | 155bb73781dced1e23e4647344a31d27859dd4dd /src/cairo-xlib-display.c | |
parent | 4dc62bbedc5d8669c0508963497c568d0202f579 (diff) |
[xlib] Check workqueue before taking the display mutex
Optimistically check to see if there is any outstanding work before
checking under the mutex. We don't care if we occasionally do not run the
queue this time due to contention, since we will most likely check again
very shortly or clean up with the display.
Diffstat (limited to 'src/cairo-xlib-display.c')
-rw-r--r-- | src/cairo-xlib-display.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c index 65df2b71..92e96bab 100644 --- a/src/cairo-xlib-display.c +++ b/src/cairo-xlib-display.c @@ -457,6 +457,12 @@ _cairo_xlib_display_notify (cairo_xlib_display_t *display) cairo_xlib_job_t *jobs, *job, *freelist; Display *dpy = display->display; + /* Optimistic atomic pointer read -- don't care if it is wrong due to + * contention as we will check again very shortly. + */ + if (display->workqueue == NULL) + return; + CAIRO_MUTEX_LOCK (display->mutex); jobs = display->workqueue; while (jobs != NULL) { |