|
|
1.1 ! root 1: #include <X/mit-copyright.h> ! 2: ! 3: /* $Header: XCloseDisplay.c,v 10.4 86/02/01 15:30:31 tony Rel $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1985 */ ! 5: ! 6: #include "XlibInternal.h" ! 7: ! 8: /* ! 9: * XCloseDisplay - XSync the connection to the X Server, close the connection, ! 10: * and free all associated storage. Signals must be masked out during this ! 11: * operation to guarantee atomicity. ! 12: */ ! 13: XCloseDisplay (dpy) ! 14: register Display *dpy; ! 15: { ! 16: register int sig_mask; ! 17: ! 18: /* ! 19: * Mask out all signals so that the library internal state can ! 20: * be sync'ed with the rest of the world. We don't want to be ! 21: * interupted while we are flushing and freeing buffers. ! 22: */ ! 23: sig_mask = sigsetmask(-1); ! 24: XSync(TRUE); ! 25: if (close(dpy->fd) == -1) { ! 26: /* Argh! someone already closed the descriptor! */ ! 27: _XIOError(_XlibCurrentDisplay); ! 28: } ! 29: sigsetmask(sig_mask); /* Return signals to normal. */ ! 30: if (dpy->displayname) free(dpy->displayname); ! 31: free(dpy->buffer); ! 32: free(dpy); ! 33: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.