You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the graphics context is only accessible during component::do_draw().
This context contains such important data as the canvas, the current
io_service, current strand, and so on. These are very useful during routines
such as animation, but are inaccessible during other times, leading to
complicated code. It could also be used to access user settings such as
terminal capabilities, preferred colours, etc.
Potential Solution #1: store a context per object. This would work but would
require that every object store a pointer to the context (expensive in terms of
memory), and would make every constructor exceedingly noisy.
Potential Solution #2: store a context object at a globally accessible
location. Care would be taken to ensure that the context object is correct for
the current UI being handled.
Problem: several threads may be competing for the globally accessible context
object.
Potential Solution #2b: store context objects for each thread in a
boost::thread_specific_ptr<>.
This seems to tick all the boxes. When a thread performs actions on a UI, it
ensures that the current context is set in the thread_specific_ptr<>. If
another thread is doing the same thing on another UI, then this ensures that
there is no contention.
Original issue reported on code.google.com by [email protected] on 18 Jul 2013 at 12:57
Original issue reported on code.google.com by
[email protected]
on 18 Jul 2013 at 12:57The text was updated successfully, but these errors were encountered: