CONS_Printf: don't blit the screen during startup if this isn't the main thread

This commit is contained in:
James R 2020-08-15 20:53:32 -07:00
parent db417a8761
commit c334230bb0
3 changed files with 19 additions and 0 deletions

View file

@ -1452,6 +1452,13 @@ void CONS_Printf(const char *fmt, ...)
Unlock_state();
#ifdef HAVE_THREADS
if (! I_on_main_thread())
{
return;
}
#endif
// if not in display loop, force screen update
if (startup)
{

View file

@ -27,6 +27,8 @@ void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
/* check in your thread whether to return early */
int I_thread_is_stopped (void);
int I_on_main_thread (void);
void I_lock_mutex (I_mutex *);
void I_unlock_mutex (I_mutex);

View file

@ -47,6 +47,8 @@ static I_mutex i_cond_pool_mutex;
static SDL_atomic_t i_threads_running = {1};
static SDL_threadID i_main_thread_id;
static Link
Insert_link (
Link * head,
@ -197,6 +199,12 @@ I_thread_is_stopped (void)
return ( ! SDL_AtomicGet(&i_threads_running) );
}
int
I_on_main_thread (void)
{
return ( SDL_ThreadID() == i_main_thread_id );
}
void
I_start_threads (void)
{
@ -211,6 +219,8 @@ I_start_threads (void)
)){
abort();
}
i_main_thread_id = SDL_ThreadID();
}
void