Hello Guest

EXCEPTION_ACCESS_VIOLATION at GLFW.glfwDestroyWindow()

  • 15 Replies
  • 9915 Views
*

Offline spasi

  • *****
  • 2163
    • WebHotelier
Re: EXCEPTION_ACCESS_VIOLATION at GLFW.glfwDestroyWindow()
« Reply #15 on: January 15, 2015, 12:41:41 »
Also see the documentation of GLFW functions, most of them require that you only call them from the main thread.

In general, if you find yourself using new Thread() { ... }.start() or any kind of old-school thread synchronization (the synchronized keyboard, wait(), notify(), etc), you're most likely going to end up with concurrency bugs and sub-optimal performance. When you do identify parts of your program that would benefit from concurrency, focus on using existing JDK APIs, like Executors and the ForkJoinPool. When you do have to use threads explicitly, focus on message passing (using queues/actors/etc) between threads, instead of shared memory. And if you're feeling adventurous, try exotic but proven solutions like fibers/coroutines instead of custom multi-threaded code.

Concurrency is hard to get right (correct results & no deadlocks) and hard to scale properly (good performance with more CPU cores).