summaryrefslogtreecommitdiff
path: root/src/common/console.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-03-13 15:48:14 +0100
committerHaru <haru@dotalux.com>2016-07-12 20:58:42 +0200
commitb9578c1d8ce54b48363e297b1c56cdea0ed72821 (patch)
tree4539010ef6af70a55b2b1515a464ebe3cfe60fcd /src/common/console.c
parent8c66f639fdd495f3d28aac905acda823fc6a0ae6 (diff)
downloadhercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.tar.gz
hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.tar.bz2
hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.tar.xz
hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.zip
Removed unnecessary typedefs from thread and spinlock
- SPIN_LOCK -> struct spin_lock - rAthread -> struct thread_handle - rAthreadProc -> threadFunc - RATHREAD_PRIO -> enum thread_priority - RAT_PRIO_LOW -> THREADPRIO_LOW - RAT_PRIO_NORMAL -> THREADPRIO_NORMAL - RAT_PRIO_HIGH -> THREADPRIO_HIGH - RA_THREADS_MAX -> THREADS_MAX Signed-off-by: Haru <haru@dotalux.com> fixupthread
Diffstat (limited to 'src/common/console.c')
-rw-r--r--src/common/console.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/console.c b/src/common/console.c
index 4a12ba24b..f1b4523e2 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -57,6 +57,7 @@ struct console_interface console_s;
struct console_interface *console;
#ifdef CONSOLE_INPUT
struct console_input_interface console_input_s;
+struct spin_lock console_ptlock_s;
struct {
char queue[CONSOLE_PARSE_SIZE][MAX_CONSOLE_INPUT];
@@ -464,15 +465,15 @@ void *cThread_main(void *x) {
console->input->parse(input);
if( input[0] != '\0' ) {/* did we get something? */
- EnterSpinLock(&console->input->ptlock);
+ EnterSpinLock(console->input->ptlock);
if( cinput.count == CONSOLE_PARSE_SIZE ) {
- LeaveSpinLock(&console->input->ptlock);
+ LeaveSpinLock(console->input->ptlock);
continue;/* drop */
}
safestrncpy(cinput.queue[cinput.count++],input,MAX_CONSOLE_INPUT);
- LeaveSpinLock(&console->input->ptlock);
+ LeaveSpinLock(console->input->ptlock);
}
}
mutex->lock(console->input->ptmutex);
@@ -484,12 +485,12 @@ void *cThread_main(void *x) {
}
int console_parse_timer(int tid, int64 tick, int id, intptr_t data) {
int i;
- EnterSpinLock(&console->input->ptlock);
+ EnterSpinLock(console->input->ptlock);
for(i = 0; i < cinput.count; i++) {
console->input->parse_sub(cinput.queue[i]);
}
cinput.count = 0;
- LeaveSpinLock(&console->input->ptlock);
+ LeaveSpinLock(console->input->ptlock);
mutex->cond_signal(console->input->ptcond);
return 0;
}
@@ -510,7 +511,7 @@ void console_parse_init(void) {
console->input->ptstate = 1;
- InitializeSpinLock(&console->input->ptlock);
+ InitializeSpinLock(console->input->ptlock);
console->input->ptmutex = mutex->create();
console->input->ptcond = mutex->cond_create();
@@ -563,6 +564,7 @@ void console_defaults(void)
console->display_gplnotice = display_gplnotice;
#ifdef CONSOLE_INPUT
console->input = &console_input_s;
+ console->input->ptlock = &console_ptlock_s;
console->input->parse_init = console_parse_init;
console->input->parse_final = console_parse_final;
console->input->parse_timer = console_parse_timer;