# Are closing window and destroying DirectX11.1 independent?

I have a project with DirectX support. In this program uses two threads. One is a dedicated message loop and the second is executing DirectX API's. The question is about ending such program. The WM_CLOSE sends asynchronous command, that stops rendering and exits DirectX loop too. After that it destroys the window. Everything works fine. The question is, is this algorithm OK? Should the window's thread or the DirectX thread be synchronized (dependent)?

• The main area of synchronization is between your 'windows thread' and the thread you call 'DXGI' from for Present. May 2 '17 at 18:18
• I highly appreciate the answer. May 2 '17 at 19:59