Merge branch 'master' of github.com:diasurgical/devilution

This commit is contained in:
Anders Jenbo 2020-11-09 01:24:02 +01:00
commit 4ae75753c8
19 changed files with 1570 additions and 1662 deletions

View file

@ -109,6 +109,32 @@ BOOL nthread_recv_turns(BOOL *pfSendAsync)
}
}
static unsigned int nthread_handler(void *data)
{
int delta;
BOOL received;
if (nthread_should_run) {
while (1) {
sgMemCrit.Enter();
if (!nthread_should_run)
break;
nthread_send_and_recv_turn(0, 0);
if (nthread_recv_turns(&received))
delta = last_tick - SDL_GetTicks();
else
delta = tick_delay;
sgMemCrit.Leave();
if (delta > 0)
SDL_Delay(delta);
if (!nthread_should_run)
return 0;
}
sgMemCrit.Leave();
}
return 0;
}
void nthread_set_turn_upper_bit()
{
turn_upper_bit = 0x80000000;
@ -169,32 +195,6 @@ void nthread_start(BOOL set_turn_upper_bit)
}
}
unsigned int nthread_handler(void *data)
{
int delta;
BOOL received;
if (nthread_should_run) {
while (1) {
sgMemCrit.Enter();
if (!nthread_should_run)
break;
nthread_send_and_recv_turn(0, 0);
if (nthread_recv_turns(&received))
delta = last_tick - SDL_GetTicks();
else
delta = tick_delay;
sgMemCrit.Leave();
if (delta > 0)
SDL_Delay(delta);
if (!nthread_should_run)
return 0;
}
sgMemCrit.Leave();
}
return 0;
}
void nthread_cleanup()
{
nthread_should_run = FALSE;