Results 1 to 7 of 7

Thread: X Error of failed request:

  1. #1

    Default X Error of failed request:

    hi,Here are my errors:

    X Error of failed request: BadAccess (attempt to access private resource denied)
    Major opcode of failed request: 153 (GLX)
    Minor opcode of failed request: 26 (X_GLXMakeContextCurrent)
    Serial number of failed request: 75
    Current serial number in output stream: 75

    And my code is(i put the render() in a thread):

    CL_Thread thread;
    thread.start(this, &Teapoy::Render);
    thread.join();

    while(!m_quit)
    {
    mp_world->Step();
    FrameCounter::Count();
    }

    void Teapoy::Render()
    {
    m_gc.clear(CL_Colorf::cyan);
    mp_gui->exec(false);
    FrameCounter::ShowFps(m_gc, 100, 200);
    DrawBox2d();
    mp_wm->draw_windows(m_gc);
    CL_KeepAlive::process();
    mp_window->flip();
    }


    void World::Step()
    {
    mp_world->Step(m_timeStep, velocityIterations, positionIterations);
    }
    I wonder what the errors mean.I think it's the CL_Thread make it. I change my code to :
    (I change the Render() to the while(!m_quit) )
    CL_Thread thread;
    thread.start(mp_world, &World::Step) //Change here
    thread.join();

    while(!m_quit)
    {
    //mp_world->Step(); //And here
    FrameCounter::Count();
    Render(); /And here
    }
    it will not have the X errors above. But i found the thread only run one time.And then i change my function in the thread to dead loop:

    void World::Step()
    {
    while (true) //Change to dead loop
    {
    mp_world->Step(m_timeStep, velocityIterations, positionIterations);
    }
    }
    it will always run the Step() function. And these code won't run;
    while(!m_quit)
    {
    mp_world->Step();
    FrameCounter::Count();
    Render();
    }
    What make "X Error of failed request" and why the thread not work correct?Thanks

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Try calling XInitThreads() at the start of your problem.

    http://tronche.com/gui/x/xlib/display/XInitThreads.html

    ClanLib "might" call this already, I cannot remember.

    Note ClanLib contains a minor XLib bug in 2.2.4 (fixed in SVN)
    void CL_X11Window::set_enabled() now should not do anything (empty function). It incorrectly set the input focus

    That will not be your problem though

  3. #3

    Default

    Quote Originally Posted by rombust View Post
    Try calling XInitThreads() at the start of your problem.

    http://tronche.com/gui/x/xlib/display/XInitThreads.html

    ClanLib "might" call this already, I cannot remember.

    Note ClanLib contains a minor XLib bug in 2.2.4 (fixed in SVN)
    void CL_X11Window::set_enabled() now should not do anything (empty function). It incorrectly set the input focus

    That will not be your problem though
    I try to Add InitThreads, but no effects, the same error. My thread thems like a normal function. When i start my thread, the statement after thread would not process until my thread function completely.What's the problem?

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    There is this function:

    Code:
    CL_GraphicContext CL_GraphicContext::create_worker_gc  (   )   
    
    Creates a new additional graphic context. 
    
    This function creates a new graphic context which shares objects with the current graphic context. Since a GC cannot be safely accessed from multiple threads simultaneously, this function allows the application to create a graphic context for the worker threads.
    I have never use ClanLib with multiple threads. I know other developers have, maybe they will know if this function will help, and how to use it

    (Assuming it actually works using XLib, and not just Windows)

  5. #5

    Default

    I hope someone know how to use this function.Thanks for your reply.

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    You might find this interesting: - http://www.rtsoft.com/forums/showthr...4149#post14149

  7. #7

    Default

    Thanks, it's helpful

Similar Threads

  1. Hanmacs request
    By Hanmac in forum Official ClanLib SDK Forums
    Replies: 18
    Last Post: 03-30-2010, 01:46 PM
  2. Replies: 5
    Last Post: 07-06-2009, 01:35 PM
  3. Help, vc++ 2008, failed compiling
    By ironized in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 08-13-2008, 06:56 AM
  4. Feature request
    By Tuttle in forum Funeral Quest
    Replies: 5
    Last Post: 07-05-2003, 03:11 PM
  5. Feature Request
    By Fugazi in forum Funeral Quest
    Replies: 1
    Last Post: 11-25-2002, 04:44 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •