Opened 8 years ago

Closed 8 years ago

#1331 closed task (wontfix)

Design: Framework to post job or execution to main thread

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: event polling must be done in the same thread as the thread that created the window, drawing can be done from any thread. Multiple windows are supported, and each may use a dedicated thread, as long as window creation and event polling for one window use the same thread.

Change History (5)

comment:1 Changed 8 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 8 years ago by bennylp

  • Description modified (diff)

comment:3 Changed 8 years ago by bennylp

  • Description modified (diff)

comment:4 Changed 8 years ago by bennylp

  • Milestone changed from release-2.0-alpha to release-2.0-beta

comment:5 Changed 8 years ago by bennylp

  • Resolution set to wontfix
  • Status changed from new to closed

Not necessary, already done similar thing in SDL dev

Note: See TracTickets for help on using tickets.