mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-11 02:30:44 +00:00
CONS_Printf: don't blit the screen during startup if this isn't the main thread
This commit is contained in:
parent
db417a8761
commit
c334230bb0
3 changed files with 19 additions and 0 deletions
|
@ -1452,6 +1452,13 @@ void CONS_Printf(const char *fmt, ...)
|
||||||
|
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
if (! I_on_main_thread())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// if not in display loop, force screen update
|
// if not in display loop, force screen update
|
||||||
if (startup)
|
if (startup)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,8 @@ void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
|
||||||
/* check in your thread whether to return early */
|
/* check in your thread whether to return early */
|
||||||
int I_thread_is_stopped (void);
|
int I_thread_is_stopped (void);
|
||||||
|
|
||||||
|
int I_on_main_thread (void);
|
||||||
|
|
||||||
void I_lock_mutex (I_mutex *);
|
void I_lock_mutex (I_mutex *);
|
||||||
void I_unlock_mutex (I_mutex);
|
void I_unlock_mutex (I_mutex);
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ static I_mutex i_cond_pool_mutex;
|
||||||
|
|
||||||
static SDL_atomic_t i_threads_running = {1};
|
static SDL_atomic_t i_threads_running = {1};
|
||||||
|
|
||||||
|
static SDL_threadID i_main_thread_id;
|
||||||
|
|
||||||
static Link
|
static Link
|
||||||
Insert_link (
|
Insert_link (
|
||||||
Link * head,
|
Link * head,
|
||||||
|
@ -197,6 +199,12 @@ I_thread_is_stopped (void)
|
||||||
return ( ! SDL_AtomicGet(&i_threads_running) );
|
return ( ! SDL_AtomicGet(&i_threads_running) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
I_on_main_thread (void)
|
||||||
|
{
|
||||||
|
return ( SDL_ThreadID() == i_main_thread_id );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
I_start_threads (void)
|
I_start_threads (void)
|
||||||
{
|
{
|
||||||
|
@ -211,6 +219,8 @@ I_start_threads (void)
|
||||||
)){
|
)){
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i_main_thread_id = SDL_ThreadID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue