I'm using sf::Thread
s in my program and I have it running in windows, but now I'm porting it over to windows. I already have the build target made and it successfully compiles, and runs right up until I try to launch the game, which uses threads. Then my objects are successfully constructed, but then it says that:
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
NumberHunterGame: xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
I'm using SFML 2.1 in my program grabbed directly from the Fedora repos.
I was reading a forum thread about passing my sf::RenderWindow
as a pointer to my rendering thread func, but I don't think that will make any difference as I made my sf::RenderWindow
instance a global. I tried calling XInitThreads()
at the beginning of main, but that causes more problems then it solves.
The whole file is available here: https://github.com/HSchmale16/NumberHunterGame/blob/master/main.cpp
Edit: I've been asked about how I have the threads set up and this is the general design.
I create the sf::RenderWindow
in the main thread then deactivate in the main thread then launch the rendering thread. After that I launch the game event handling thread. The only thing the main thread handles is the window events, so it should be thread safe. The SFML docs say that I can handle the window events in the main thread while using another thread to render.