struct uiomux_state * get_shared_state (void) { struct uiomux_state * state; state = create_shared_state (); if (state == NULL) { switch (errno) { case EEXIST: #ifdef DEBUG fprintf (stderr, "get_shared_state: already created, mapping ...\n"); #endif state = map_shared_state (); break; default: perror ("uiomux: Could not create shared state"); break; } } else { #ifdef DEBUG fprintf (stderr, "get_shared_state: created, initializing ...\n"); #endif init_shared_state (state); } return state; }
QtUtil :: Grid3DView :: SharedState & QtUtil :: Grid3DView :: shared_state () { if (! m_shared_state) { m_shared_state .reset (create_shared_state ()); m_shared_state -> m_views .insert (this); } return * m_shared_state; }
const QtUtil :: Grid3DView :: SharedState & QtUtil :: Grid3DView :: shared_state () const { if (! m_shared_state) { auto self = const_cast <Grid3DView *> (this); self -> m_shared_state .reset (create_shared_state ()); self -> m_shared_state -> m_views .insert (self); } return * m_shared_state; }