#include <time.h>
#include "quakedef.h"
+#include "thread.h"
// for u8_encodech
#include "ft2.h"
int con_backscroll;
conbuffer_t con;
+void *con_mutex = NULL;
#define CON_LINES(i) CONBUFFER_LINES(&con, i)
#define CON_LINES_LAST CONBUFFER_LINES_LAST(&con)
Con_Printf("condump: unable to write file \"%s\"\n", Cmd_Argv(1));
return;
}
+ if (con_mutex) Thread_LockMutex(con_mutex);
for(i = 0; i < CON_LINES_COUNT; ++i)
{
FS_Write(file, CON_LINES(i).start, CON_LINES(i).len);
FS_Write(file, "\n", 1);
}
+ if (con_mutex) Thread_UnlockMutex(con_mutex);
FS_Close(file);
}
void Con_Clear_f (void)
{
+ if (con_mutex) Thread_LockMutex(con_mutex);
ConBuffer_Clear(&con);
+ if (con_mutex) Thread_UnlockMutex(con_mutex);
}
/*
{
con_linewidth = 80;
ConBuffer_Init(&con, CON_TEXTSIZE, CON_MAXLINES, zonemempool);
+ if (Thread_HasThreads())
+ con_mutex = Thread_CreateMutex();
// Allocate a log queue, this will be freed after configs are parsed
logq_size = MAX_INPUTLINE;
void Con_Shutdown (void)
{
+ if (con_mutex) Thread_LockMutex(con_mutex);
ConBuffer_Shutdown(&con);
+ if (con_mutex) Thread_UnlockMutex(con_mutex);
+ if (con_mutex) Thread_DestroyMutex(con_mutex);con_mutex = NULL;
}
/*
if(!con.text) // FIXME uses a non-abstracted property of con
return;
+ if (con_mutex) Thread_LockMutex(con_mutex);
for(; *txt; ++txt)
{
if(cr_pending)
break;
}
}
+ if (con_mutex) Thread_UnlockMutex(con_mutex);
}
/*! The translation table between the graphical font and plain ASCII --KB */
static int index = 0;
static char line[MAX_INPUTLINE];
+ if (con_mutex)
+ Thread_LockMutex(con_mutex);
+
for (;*msg;msg++)
{
Con_Rcon_AddChar(*msg);
mask = 0;
}
}
+
+ if (con_mutex)
+ Thread_UnlockMutex(con_mutex);
}
/*
int numChatlines;
int chatpos;
+ if (con_mutex) Thread_LockMutex(con_mutex);
ConBuffer_FixTimes(&con);
numChatlines = con_chat.integer;
x = min(xr, x);
DrawQ_String(x, v, temptext, 0, inputsize, inputsize, 1.0, 1.0, 1.0, 1.0, 0, &colorindex, false, FONT_CHAT);
}
+ if (con_mutex) Thread_UnlockMutex(con_mutex);
}
/*
if (lines <= 0)
return;
+ if (con_mutex) Thread_LockMutex(con_mutex);
+
if (con_backscroll < 0)
con_backscroll = 0;
Con_DrawInput ();
r_draw2d_force = false;
+ if (con_mutex) Thread_UnlockMutex(con_mutex);
}
/*