[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    [PATCH xcb] Fix hanging issue in _XReply
From:       Tatu Frisk <tatu.frisk () iki ! fi>
Date:       2018-05-23 20:37:50
Message-ID: alpine.DEB.2.11.1805232309010.17274 () lakka ! kapsi ! fi
[Download RAW message or body]

I just noticed this had made it here. I pasted below a reproducer app. The 
thread blocks until a key is pressed.

About the patch itself, it looks like the assumption of the patch is also 
made on xcb_io.c, line 347, where it is more cautiously called a 
"reasonable claim".



#include <X11/Xlib.h>
#include <stdio.h>
#include <pthread.h>

Display* d;

void* thread(void *ptr)
{
     int actualCount;
     XListFonts(d, "", 1, &actualCount);
     printf("thread finished\n");
}

int main(void) {
    pthread_t t;
    XEvent e;
    Window w;
    int s;

    XInitThreads();

    d = XOpenDisplay(NULL);
    s = DefaultScreen(d);
    w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 100, 100, 1,
 			   BlackPixel(d, s), WhitePixel(d, s));
    XSelectInput(d, w, KeyPressMask);
    XMapWindow(d, w);

    pthread_create( &t, NULL, thread, NULL);

    while (1) {
       XNextEvent(d, &e);
       if (e.type == KeyPress)
          break;
     }

    XCloseDisplay(d);
    printf("main finished\n");
    return 0;
}

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic