Opened 13 years ago

Last modified 12 years ago

#1331 closed task

Design: Framework to post job or execution to main thread — at Version 2

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.0-beta
Component: pjlib Version: 2.0-dev-branch
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

SDL requires its execution to be executed on main thread, or in the same thread that the window was created, depending on platform. This ticket creates a framework to perform this task.

Note: this may need to change #1278 (System specific initialization during application startup)

Update 22/07/11:

After some testing, we found that main thread execution is only required for Mac OS X, and we can limit this Mac OS specific approach to the sdl_dev.c only. The following is summary on thread execution model for SDL across various platforms. They are tested against SDL-1.3 (latest from repository as of this date).

Mac OS X: everything must be done in main thread.

Linux/X11: drawing and event polling must be done in the same thread as the thread that created the window, otherwise there will be no picture. Multiple windows are supported, but they must be done in the same one thread (it doesn't have to be the main thread). If each of the window uses a separate thread, crash will happen during window creation.

Windows: drawing and event polling must be done in the same thread as the thread that created the window. Multiple windows are supported, and each may use a dedicated thread, as long as window creation, drawing, and event polling for one window all use the same thread.

Change History (2)

comment:1 Changed 13 years ago by bennylp

  • Description modified (diff)
  • Summary changed from Framework to post job or execution to main thread to Design: Framework to post job or execution to main thread

comment:2 Changed 13 years ago by bennylp

  • Description modified (diff)
Note: See TracTickets for help on using tickets.