LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2011, 02:44 PM   #1
10_GOTO_10
LQ Newbie
 
Registered: Aug 2011
Posts: 1

Rep: Reputation: 0
"fatal IO error 11 (Resource temporarily unavailable) on X server" with two windows


Hi,

I am programming on XLib with Code::blocks, and I have a crash when I opens two windows and I close one of them. I am on Ubuntu 10.10 64 bits, but it is the same thing on a virtual machine and Ubuntu 11.04 32 bits. the program is a sample "hello world" where I have just added a second window. The crash happens when I close one of the two windows:

Quote:
fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0" after 16 requests (14 known processed) with 0 events remaining.

Process retourned 1 (0x1) execution time : 9.120 s
Press ENTER to continue
I have found this thread and this thread, but no one wich seems like my problem.

My code:

Quote:
/*
* xsimple : Affiche une chaine dans une fenetre X...
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _X_SENTINEL(x)
#include <X11/Xlib.h>

GC gc;
Display *display;
int screen;
Window win1, win2, root;
unsigned long white_pixel, black_pixel;


/*
* fonction associee a l'evenement EXPOSE
*/

void expose (Window win)
{
XDrawString (display, win, gc, 10, 30, "Hello, world !", 14);
}


/*
* programme principal
*/

int main(int ac, char **av) {
char *dpyn = NULL;

/* selection du display en ligne */
if (ac == 3) {
if (strcmp (&av[1][1], "display") == 0) {
dpyn = av[2];
}
else {
fprintf (stderr, "Usage: xsimple [-display display_name]\n");
exit (1);
}
}

if ((display = XOpenDisplay (dpyn)) == NULL) {
fprintf (stderr, "Can't open Display\n");
exit (1);
}

// XSetCloseDownMode(display, RetainTemporary /*RetainPermanent*/);

screen = DefaultScreen (display);
gc = DefaultGC (display, screen);
root = RootWindow (display, screen);
white_pixel = WhitePixel (display, screen);
black_pixel = BlackPixel (display, screen);


win1 = XCreateSimpleWindow (display, root, 0, 0, 200, 100, 2, black_pixel, white_pixel);
win2 = XCreateSimpleWindow (display, root, 300, 0, 200, 100, 2, black_pixel, white_pixel);

XSelectInput (display, win1, ExposureMask);
XSelectInput (display, win2, ExposureMask);

XStoreName (display, win1, "xsimple 1");
XMapWindow (display, win1);

XStoreName (display, win2, "xsimple 2");
XMapWindow (display, win2);


for ( ; ; ) {
XEvent ev;

XNextEvent (display, &ev);

switch (ev.type) {

case Expose :

expose (ev.xany.window);
break;

default :

break;

}
}
}
Thanks to all
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DVD error (but still server related) - Resource temporarily unavailable guna_pmk Linux - Server 3 07-07-2011 05:03 AM
Samba "mount error(11): Resource temporarily unavailable" RWallett Linux - Server 1 07-01-2010 01:00 PM
"fork: Resource temporarily unavailable" for certain user yoachan Linux - Server 6 01-06-2010 08:46 PM
"FUTEX WAIT EAGAIN (Resource temporarily unavailable )" jungbg Linux - Newbie 1 12-22-2009 05:07 PM
Cifs "mount error 11 = Resource temporarily unavailable" humbletech99 Linux - Networking 1 09-26-2006 12:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration