Remove libxcb-xlib and xcbxlib.h.

This commit is contained in:
Jamey Sharp 2008-03-14 12:08:32 -07:00
parent dcbef23d73
commit d989656cde
8 changed files with 6 additions and 220 deletions

View File

@ -2,9 +2,7 @@ SUBDIRS=src tests doc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
xcb.pc \
xcb-xlib.pc
pkgconfig_DATA = xcb.pc
if BUILD_COMPOSITE
pkgconfig_DATA += xcb-composite.pc

View File

@ -50,8 +50,6 @@ PKG_CHECK_MODULES(XDMCP, xdmcp,
], [$XDMCP_LIBS]),
[AC_MSG_RESULT(no)])
AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
AC_SUBST(NEEDED)
# Find the xcb-proto protocol descriptions
@ -151,7 +149,6 @@ tests/Makefile
AC_CONFIG_FILES([
xcb.pc
xcb-xlib.pc
xcb-composite.pc
xcb-damage.pc
xcb-dpms.pc

View File

@ -1,5 +1,4 @@
lib_LTLIBRARIES = libxcb.la \
libxcb-xlib.la
lib_LTLIBRARIES = libxcb.la
EXTHEADERS = xproto.h \
bigreq.h \
@ -29,10 +28,6 @@ libxcb_la_LDFLAGS = -version-info 1:0:0
XCB_LIBS = libxcb.la
libxcb_xlib_la_LDFLAGS = -version-info 0:0:0
libxcb_xlib_la_LIBADD = $(XCB_LIBS)
libxcb_xlib_la_SOURCES = xcb_xlib.c
# FIXME: find a way to autogenerate this from the XML files.
EXTHEADERS += composite.h
@ -257,7 +252,7 @@ endif
xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(EXTHEADERS)
xcbinclude_HEADERS = xcb.h xcbext.h $(EXTHEADERS)
noinst_HEADERS = xcbint.h
BUILT_SOURCES = $(EXTSOURCES) $(EXTHEADERS)

View File

@ -59,21 +59,6 @@ static int set_fd_flags(const int fd)
return 1;
}
static int _xcb_xlib_init(_xcb_xlib *xlib)
{
xlib->lock = 0;
#ifndef NDEBUG
xlib->sloppy_lock = (getenv("LIBXCB_ALLOW_SLOPPY_LOCK") != 0);
#endif
pthread_cond_init(&xlib->cond, 0);
return 1;
}
static void _xcb_xlib_destroy(_xcb_xlib *xlib)
{
pthread_cond_destroy(&xlib->cond);
}
static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
{
static const char pad[3];
@ -230,7 +215,6 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
if(!(
set_fd_flags(fd) &&
pthread_mutex_init(&c->iolock, 0) == 0 &&
_xcb_xlib_init(&c->xlib) &&
_xcb_in_init(&c->in) &&
_xcb_out_init(&c->out) &&
write_setup(c, auth_info) &&
@ -255,7 +239,6 @@ void xcb_disconnect(xcb_connection_t *c)
close(c->fd);
pthread_mutex_destroy(&c->iolock);
_xcb_xlib_destroy(&c->xlib);
_xcb_in_destroy(&c->in);
_xcb_out_destroy(&c->out);
@ -275,12 +258,6 @@ void _xcb_conn_shutdown(xcb_connection_t *c)
void _xcb_lock_io(xcb_connection_t *c)
{
pthread_mutex_lock(&c->iolock);
while(c->xlib.lock)
{
if(pthread_equal(c->xlib.thread, pthread_self()))
break;
pthread_cond_wait(&c->xlib.cond, &c->iolock);
}
}
void _xcb_unlock_io(xcb_connection_t *c)
@ -290,25 +267,12 @@ void _xcb_unlock_io(xcb_connection_t *c)
void _xcb_wait_io(xcb_connection_t *c, pthread_cond_t *cond)
{
int xlib_locked = c->xlib.lock;
if(xlib_locked)
{
c->xlib.lock = 0;
pthread_cond_broadcast(&c->xlib.cond);
}
pthread_cond_wait(cond, &c->iolock);
if(xlib_locked)
{
while(c->xlib.lock)
pthread_cond_wait(&c->xlib.cond, &c->iolock);
c->xlib.lock = 1;
c->xlib.thread = pthread_self();
}
}
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
{
int ret, xlib_locked;
int ret;
fd_set rfds, wfds;
/* If the thing I should be doing is already being done, wait for it. */
@ -329,12 +293,6 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
++c->out.writing;
}
xlib_locked = c->xlib.lock;
if(xlib_locked)
{
c->xlib.lock = 0;
pthread_cond_broadcast(&c->xlib.cond);
}
_xcb_unlock_io(c);
do {
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
@ -345,11 +303,6 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
ret = 0;
}
_xcb_lock_io(c);
if(xlib_locked)
{
c->xlib.lock = 1;
c->xlib.thread = pthread_self();
}
if(ret)
{

View File

@ -1,87 +0,0 @@
/* Copyright (C) 2005 Bart Massey and Jamey Sharp.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the names of the authors or their
* institutions shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the authors.
*/
#include "xcbxlib.h"
#include "xcbint.h"
#include <assert.h>
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
#endif
static void xcb_xlib_printbt(void)
{
#ifdef HAVE_BACKTRACE
void *array[20];
int size;
char **strings;
int i;
size = backtrace(array, 20);
strings = backtrace_symbols(array, size);
fprintf(stderr, "Locking assertion failure. Backtrace:\n");
for (i = 0; i < size; ++i)
fprintf(stderr, "#%i %s\n", i, strings[i]);
free(strings);
#endif
}
#ifndef NDEBUG
#define xcb_assert(c,x) do { if (!(x)) { xcb_xlib_printbt(); if (!(c)->xlib.sloppy_lock) assert(x); } } while(0)
#else
#define xcb_assert(c,x)
#endif
unsigned int xcb_get_request_sent(xcb_connection_t *c)
{
if(c->has_error)
return 0;
return c->out.request;
}
void xcb_xlib_lock(xcb_connection_t *c)
{
_xcb_lock_io(c);
xcb_assert(c, !c->xlib.lock);
c->xlib.lock = 1;
c->xlib.thread = pthread_self();
_xcb_unlock_io(c);
}
void xcb_xlib_unlock(xcb_connection_t *c)
{
_xcb_lock_io(c);
xcb_assert(c, c->xlib.lock);
xcb_assert(c, pthread_equal(c->xlib.thread, pthread_self()));
c->xlib.lock = 0;
pthread_cond_broadcast(&c->xlib.cond);
_xcb_unlock_io(c);
}

View File

@ -126,16 +126,6 @@ int _xcb_in_read(xcb_connection_t *c);
int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
/* xcb_xlib.c */
typedef struct _xcb_xlib {
int lock;
int sloppy_lock;
pthread_t thread;
pthread_cond_t cond;
} _xcb_xlib;
/* xcb_xid.c */
typedef struct _xcb_xid {
@ -173,7 +163,6 @@ struct xcb_connection_t {
/* I/O data */
pthread_mutex_t iolock;
_xcb_xlib xlib;
_xcb_in in;
_xcb_out out;
@ -183,6 +172,8 @@ struct xcb_connection_t {
};
void _xcb_conn_shutdown(xcb_connection_t *c);
void _xcb_lock_io(xcb_connection_t *c);
void _xcb_unlock_io(xcb_connection_t *c);
void _xcb_wait_io(xcb_connection_t *c, pthread_cond_t *cond);
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
@ -195,10 +186,4 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
#pragma GCC visibility pop
#endif
/* xcb_conn.c symbols visible to xcb-xlib */
void _xcb_lock_io(xcb_connection_t *c);
void _xcb_unlock_io(xcb_connection_t *c);
#endif

View File

@ -1,44 +0,0 @@
/*
* Copyright (C) 2005 Bart Massey and Jamey Sharp.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the names of the authors or their
* institutions shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the authors.
*/
/* This include file declares functions used by Xlib/XCB, but nothing else
* should ever use these functions or link to libxcb-xlib. */
#ifndef __XCBXLIB_H
#define __XCBXLIB_H
#include <pthread.h>
#include "xcb.h"
/* The caller of this function must hold the xlib lock, using the lock
* functions below. */
unsigned int xcb_get_request_sent(xcb_connection_t *c);
void xcb_xlib_lock(xcb_connection_t *c);
void xcb_xlib_unlock(xcb_connection_t *c);
#endif

View File

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: XCB Xlib
Description: XCB Xlib support functions
Version: @PACKAGE_VERSION@
Requires: xcb
Libs: -L${libdir} -lxcb-xlib
Cflags: -I${includedir}