Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:Test
xorg-x11-libxcb-unstable-devel
always-sloppy.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File always-sloppy.diff of Package xorg-x11-libxcb-unstable-devel
diff -urp ../libxcb-1.1.orig/src/xcb_conn.c ./src/xcb_conn.c --- ../libxcb-1.1.orig/src/xcb_conn.c 2007-10-28 21:11:18.000000000 +0100 +++ ./src/xcb_conn.c 2007-11-05 14:25:47.000000000 +0100 @@ -62,9 +62,7 @@ static int set_fd_flags(const int fd) static int _xcb_xlib_init(_xcb_xlib *xlib) { xlib->lock = 0; -#ifndef NDEBUG - xlib->sloppy_lock = (getenv("LIBXCB_ALLOW_SLOPPY_LOCK") != 0); -#endif + xlib->sloppy_lock = 0; pthread_cond_init(&xlib->cond, 0); return 1; } diff -urp ../libxcb-1.1.orig/src/xcb_xlib.c ./src/xcb_xlib.c --- ../libxcb-1.1.orig/src/xcb_xlib.c 2007-10-23 19:17:31.000000000 +0200 +++ ./src/xcb_xlib.c 2007-11-05 14:31:09.000000000 +0100 @@ -26,6 +26,7 @@ #include "xcbxlib.h" #include "xcbint.h" +#include <unistd.h> #include <assert.h> #ifdef HAVE_BACKTRACE @@ -55,7 +56,7 @@ static void xcb_xlib_printbt(void) } #ifndef NDEBUG -#define xcb_assert(c,x) do { if (!(x)) { xcb_xlib_printbt(); if (!(c)->xlib.sloppy_lock) assert(x); } } while(0) +#define xcb_assert(c,x) do { if (!(x)) { xcb_xlib_printbt(); assert(x); } } while(0) #else #define xcb_assert(c,x) #endif @@ -69,8 +70,12 @@ unsigned int xcb_get_request_sent(xcb_co void xcb_xlib_lock(xcb_connection_t *c) { + static const char xcb_sloppy_warn[] = "libxcb: WARNING! Program tries to lock an already locked connection,\n which indicates a programming error.\n There will be no further warnings about this issue.\n"; _xcb_lock_io(c); - xcb_assert(c, !c->xlib.lock); + if (c->xlib.lock && !(c->xlib.sloppy_lock & 1)) { + write(STDERR_FILENO, xcb_sloppy_warn, sizeof(xcb_sloppy_warn)-1); + c->xlib.sloppy_lock |= 1; + } c->xlib.lock = 1; c->xlib.thread = pthread_self(); _xcb_unlock_io(c); @@ -78,9 +83,18 @@ void xcb_xlib_lock(xcb_connection_t *c) void xcb_xlib_unlock(xcb_connection_t *c) { + static const char xcb_sloppy_warn[] = "libxcb: WARNING! Program tries to unlock a connection without having acquired\n a lock first, which indicates a programming error.\n There will be no further warnings about this issue.\n"; + static const char xcb_sloppy_warn2[] = "libxcb: WARNING! Program tries to unlock a connection from a different thread\n than the lock was acquired, which indicates a programming error.\n There will be no further warnings about this issue.\n"; _xcb_lock_io(c); - xcb_assert(c, c->xlib.lock); - xcb_assert(c, pthread_equal(c->xlib.thread, pthread_self())); + if (!c->xlib.lock && !(c->xlib.sloppy_lock & 2)) { + write(STDERR_FILENO, xcb_sloppy_warn, sizeof(xcb_sloppy_warn)-1); + c->xlib.sloppy_lock |= 2; + } + if (!pthread_equal(c->xlib.thread, pthread_self()) && + !(c->xlib.sloppy_lock & 4)) { + write(STDERR_FILENO, xcb_sloppy_warn2, sizeof(xcb_sloppy_warn2)-1); + c->xlib.sloppy_lock |= 4; + } c->xlib.lock = 0; pthread_cond_broadcast(&c->xlib.cond); _xcb_unlock_io(c);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor