LaurentGomila/SFML — Issue #159: SFML can't be used outside of the main thread on OS X
Author: otibom
Created: 2012-01-22 17:00:28+00:00
State: open

[This forum post](http://www.sfml-dev.org/forum/viewtopic.php?p=27685&sid=8001ca9d3d282a598cc028033632e648) mentions it last year. [Apparently](http://lists.apple.com/archives/cocoa-dev/2011/Feb/msg00493.html) it can't be fixed :(
It should added to the documentation.

Example :

``` C++
#include
#include

struct graphics
{
graphics() :
window(sf::VideoMode(800, 600), "Hello world")
{
}

void operator()()
{
while (window.IsOpened())
{
sf::Event event;
while (window.PollEvent(event))
{
if (event.Type == sf::Event::Closed)
window.Close();
}

window.Clear();
window.Display();
}
}

private:
sf::RenderWindow window;
};

int main()
{
graphics g;

boost::thread gthread(boost::ref(g));
gthread.join();
}
```