Проблема с использованием graphics.h в Ubuntu

# include<stdio.h>
# include<graphics.h>
# include<math.h>
using namespace std;
int main(void)
{
    int gd=DETECT,gm;
    int r,x,y,p,xc=320,yc=240;

    initgraph(&gd,&gm,NULL);
    cleardevice();


    printf("Enter the radius ");
    scanf("%d",&r);


    x=0;
    y=r;
    putpixel(xc+x,yc-y,1);

    p=3-(2*r);

    for(x=0;x<=y;x++)
    {
        if (p<0)
        {
             y=y;
            p=(p+(4*x)+6);
        }
        else
        {
            y=y-1;

            p=p+((4*(x-y)+10));
        }

    putpixel(xc+x,yc-y,1);
    putpixel(xc-x,yc-y,2);
    putpixel(xc+x,yc+y,3);
    putpixel(xc-x,yc+y,4);
    putpixel(xc+y,yc-x,5);
    putpixel(xc-y,yc-x,6);
    putpixel(xc+y,yc+x,7);
    putpixel(xc-y,yc+x,8);

    }
    getch();
    closegraph();
}
  • установлен graphics.h
  • , скомпилированный с использованием gcc filename.cpp -0 filename -lgraph
  • , затем используется ./filename
  • окно, отображаемое в течение 10 секунд и появляется следующая ошибка:
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
heart: ../../src/xcb_io.c:273: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted

Любые решения?

0
задан 29 May 2012 в 14:04

6 ответов

В Launchpad есть ошибка , очень похожая на указанную выше проблему.

Одно сообщение содержит цитату из источника, детализирующего, когда эта ошибка возникает условие:

Сообщение об ошибке «Неизвестный порядковый номер при обработке очереди» встречается в куске текста с этим большим предупреждением перед ним, о безопасности потоков в клиентском коде:

/* Thread-safety rules:
 *
 * At most one thread can be reading from XCB's event queue at a time.
 * If you are not the current event-reading thread and you need to find
 * out if an event is available, you must wait.
 *
 * The same rule applies for reading replies.
 *
 * A single thread cannot be both the the event-reading and the
 * reply-reading thread at the same time.
 *
 * We always look at both the current event and the first pending reply
 * to decide which to process next.
 *
 * We always process all responses in sequence-number order, which may
 * mean waiting for another thread (either the event_waiter or the
 * reply_waiter) to handle an earlier response before we can process or
 * return a later one. If so, we wait on the corresponding condition
 * variable for that thread to process the response and wake us up.
 */

Возможно, это может показаться, что это клиентское приложение может иметь ошибочную логику в обработке потоков как относящуюся к вызовам xcb?

1
ответ дан 25 July 2018 в 19:46

В Launchpad есть ошибка , очень похожая на указанную выше проблему.

Одно сообщение содержит цитату из источника, детализирующего, когда эта ошибка возникает условие:

Сообщение об ошибке «Неизвестный порядковый номер при обработке очереди» встречается в куске текста с этим большим предупреждением перед ним, о безопасности потоков в клиентском коде:

/* Thread-safety rules:
 *
 * At most one thread can be reading from XCB's event queue at a time.
 * If you are not the current event-reading thread and you need to find
 * out if an event is available, you must wait.
 *
 * The same rule applies for reading replies.
 *
 * A single thread cannot be both the the event-reading and the
 * reply-reading thread at the same time.
 *
 * We always look at both the current event and the first pending reply
 * to decide which to process next.
 *
 * We always process all responses in sequence-number order, which may
 * mean waiting for another thread (either the event_waiter or the
 * reply_waiter) to handle an earlier response before we can process or
 * return a later one. If so, we wait on the corresponding condition
 * variable for that thread to process the response and wake us up.
 */

Возможно, это может показаться, что это клиентское приложение может иметь ошибочную логику в обработке потоков как относящуюся к вызовам xcb?

1
ответ дан 2 August 2018 в 01:45

В Launchpad есть ошибка , очень похожая на указанную выше проблему.

Одно сообщение содержит цитату из источника, детализирующего, когда эта ошибка возникает условие:

Сообщение об ошибке «Неизвестный порядковый номер при обработке очереди» встречается в куске текста с этим большим предупреждением перед ним, о безопасности потоков в клиентском коде:

/* Thread-safety rules:
 *
 * At most one thread can be reading from XCB's event queue at a time.
 * If you are not the current event-reading thread and you need to find
 * out if an event is available, you must wait.
 *
 * The same rule applies for reading replies.
 *
 * A single thread cannot be both the the event-reading and the
 * reply-reading thread at the same time.
 *
 * We always look at both the current event and the first pending reply
 * to decide which to process next.
 *
 * We always process all responses in sequence-number order, which may
 * mean waiting for another thread (either the event_waiter or the
 * reply_waiter) to handle an earlier response before we can process or
 * return a later one. If so, we wait on the corresponding condition
 * variable for that thread to process the response and wake us up.
 */

Возможно, это может показаться, что это клиентское приложение может иметь ошибочную логику в обработке потоков как относящуюся к вызовам xcb?

1
ответ дан 4 August 2018 в 17:24

В Launchpad есть ошибка , очень похожая на указанную выше проблему.

Одно сообщение содержит цитату из источника, детализирующего, когда эта ошибка возникает условие:

Сообщение об ошибке «Неизвестный порядковый номер при обработке очереди» встречается в куске текста с этим большим предупреждением перед ним, о безопасности потоков в клиентском коде:

/* Thread-safety rules:
 *
 * At most one thread can be reading from XCB's event queue at a time.
 * If you are not the current event-reading thread and you need to find
 * out if an event is available, you must wait.
 *
 * The same rule applies for reading replies.
 *
 * A single thread cannot be both the the event-reading and the
 * reply-reading thread at the same time.
 *
 * We always look at both the current event and the first pending reply
 * to decide which to process next.
 *
 * We always process all responses in sequence-number order, which may
 * mean waiting for another thread (either the event_waiter or the
 * reply_waiter) to handle an earlier response before we can process or
 * return a later one. If so, we wait on the corresponding condition
 * variable for that thread to process the response and wake us up.
 */

Возможно, это может показаться, что это клиентское приложение может иметь ошибочную логику в обработке потоков как относящуюся к вызовам xcb?

1
ответ дан 6 August 2018 в 02:00

В Launchpad есть ошибка , очень похожая на указанную выше проблему.

Одно сообщение содержит цитату из источника, детализирующего, когда эта ошибка возникает условие:

Сообщение об ошибке «Неизвестный порядковый номер при обработке очереди» встречается в куске текста с этим большим предупреждением перед ним, о безопасности потоков в клиентском коде:

/* Thread-safety rules:
 *
 * At most one thread can be reading from XCB's event queue at a time.
 * If you are not the current event-reading thread and you need to find
 * out if an event is available, you must wait.
 *
 * The same rule applies for reading replies.
 *
 * A single thread cannot be both the the event-reading and the
 * reply-reading thread at the same time.
 *
 * We always look at both the current event and the first pending reply
 * to decide which to process next.
 *
 * We always process all responses in sequence-number order, which may
 * mean waiting for another thread (either the event_waiter or the
 * reply_waiter) to handle an earlier response before we can process or
 * return a later one. If so, we wait on the corresponding condition
 * variable for that thread to process the response and wake us up.
 */

Возможно, это может показаться, что это клиентское приложение может иметь ошибочную логику в обработке потоков как относящуюся к вызовам xcb?

1
ответ дан 7 August 2018 в 19:32

В Launchpad есть ошибка , очень похожая на указанную выше проблему.

Одно сообщение содержит цитату из источника, детализирующего, когда эта ошибка возникает условие:

Сообщение об ошибке «Неизвестный порядковый номер при обработке очереди» встречается в куске текста с этим большим предупреждением перед ним, о безопасности потоков в клиентском коде:

/* Thread-safety rules:
 *
 * At most one thread can be reading from XCB's event queue at a time.
 * If you are not the current event-reading thread and you need to find
 * out if an event is available, you must wait.
 *
 * The same rule applies for reading replies.
 *
 * A single thread cannot be both the the event-reading and the
 * reply-reading thread at the same time.
 *
 * We always look at both the current event and the first pending reply
 * to decide which to process next.
 *
 * We always process all responses in sequence-number order, which may
 * mean waiting for another thread (either the event_waiter or the
 * reply_waiter) to handle an earlier response before we can process or
 * return a later one. If so, we wait on the corresponding condition
 * variable for that thread to process the response and wake us up.
 */

Возможно, это может показаться, что это клиентское приложение может иметь ошибочную логику в обработке потоков как относящуюся к вызовам xcb?

1
ответ дан 15 August 2018 в 20:01

Другие вопросы по тегам:

Похожие вопросы: