Get rid of mutexes on command buffer
This commit is contained in:
parent
8367a8553c
commit
b6188a3b16
|
@ -37,17 +37,6 @@
|
||||||
#include "d_netfil.h" // findfile
|
#include "d_netfil.h" // findfile
|
||||||
#include "d_async.h"
|
#include "d_async.h"
|
||||||
#include "filesrch.h"
|
#include "filesrch.h"
|
||||||
#include "i_threads.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
static I_mutex com_text_mutex;
|
|
||||||
|
|
||||||
# define Lock_state() I_lock_mutex(&com_text_mutex)
|
|
||||||
# define Unlock_state() I_unlock_mutex(com_text_mutex)
|
|
||||||
#else/*HAVE_THREADS*/
|
|
||||||
# define Lock_state()
|
|
||||||
# define Unlock_state()
|
|
||||||
#endif/*HAVE_THREADS*/
|
|
||||||
|
|
||||||
//========
|
//========
|
||||||
// protos.
|
// protos.
|
||||||
|
@ -133,14 +122,10 @@ void COM_BufAddText(const char *ptext)
|
||||||
|
|
||||||
l = strlen(ptext);
|
l = strlen(ptext);
|
||||||
|
|
||||||
Lock_state();
|
|
||||||
|
|
||||||
if (com_text.cursize + l >= com_text.maxsize)
|
if (com_text.cursize + l >= com_text.maxsize)
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Command buffer full!\n"));
|
CONS_Alert(CONS_WARNING, M_GetText("Command buffer full!\n"));
|
||||||
else
|
else
|
||||||
VS_Write(&com_text, ptext, l);
|
VS_Write(&com_text, ptext, l);
|
||||||
|
|
||||||
Unlock_state();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds command text and executes it immediately.
|
/** Adds command text and executes it immediately.
|
||||||
|
@ -153,8 +138,6 @@ void COM_BufInsertText(const char *ptext)
|
||||||
char *temp = NULL;
|
char *temp = NULL;
|
||||||
size_t templen;
|
size_t templen;
|
||||||
|
|
||||||
Lock_state();
|
|
||||||
|
|
||||||
// copy off any commands still remaining in the exec buffer
|
// copy off any commands still remaining in the exec buffer
|
||||||
templen = com_text.cursize;
|
templen = com_text.cursize;
|
||||||
if (templen)
|
if (templen)
|
||||||
|
@ -173,8 +156,6 @@ void COM_BufInsertText(const char *ptext)
|
||||||
VS_Write(&com_text, temp, templen);
|
VS_Write(&com_text, temp, templen);
|
||||||
Z_Free(temp);
|
Z_Free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock_state();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Progress the wait timer and flush waiting console commands when ready.
|
/** Progress the wait timer and flush waiting console commands when ready.
|
||||||
|
@ -200,8 +181,6 @@ void COM_BufExecute(void)
|
||||||
char line[1024] = "";
|
char line[1024] = "";
|
||||||
INT32 quotes;
|
INT32 quotes;
|
||||||
|
|
||||||
Lock_state();
|
|
||||||
|
|
||||||
while (com_text.cursize)
|
while (com_text.cursize)
|
||||||
{
|
{
|
||||||
// find a '\n' or; line break
|
// find a '\n' or; line break
|
||||||
|
@ -249,8 +228,6 @@ void COM_BufExecute(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock_state();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Executes a string immediately. Used for skirting around WAIT commands.
|
/** Executes a string immediately. Used for skirting around WAIT commands.
|
||||||
|
|
Loading…
Reference in New Issue