From: Allura u. <al...@so...> - 2023-02-07 22:56:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A KallistiOS implementation of conio. ". The branch, master has been updated via 63be6e2616ddb99807003645639b85e96de2e4ab (commit) from 5b9180ee3f0be2f58ce3ac3b5f29ae91d39df4e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 63be6e2616ddb99807003645639b85e96de2e4ab Author: Andress Barajas <and...@gm...> Date: Tue Feb 7 09:29:01 2023 -0800 Remove use of old sem_create() ----------------------------------------------------------------------- Summary of changes: conio.c | 14 +++++++------- input.c | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/conio.c b/conio.c index e19fca8..e8d5dca 100644 --- a/conio.c +++ b/conio.c @@ -27,7 +27,7 @@ int conio_ttymode = CONIO_TTY_NONE, conio_inputmode = CONIO_INPUT_NONE; int conio_theme = CONIO_THEME_PLAIN; /* freeze/thaw mutex */ -static semaphore_t *ft_mutex; +static semaphore_t ft_mutex; /* File handle for serial tty */ file_t conio_serial_fd; @@ -330,12 +330,12 @@ void conio_clear() { /* conio freeze (for sub-process taking over TA) */ void conio_freeze() { - sem_wait(ft_mutex); + sem_wait(&ft_mutex); } /* conio thaw */ void conio_thaw() { - sem_signal(ft_mutex); + sem_signal(&ft_mutex); } /* set theme */ @@ -353,7 +353,7 @@ static volatile int conio_exit = 0; static void *conio_thread(void *param) { conio_entered = 1; while (!conio_exit) { - sem_wait(ft_mutex); + sem_wait(&ft_mutex); conio_input_frame(); if (conio_ttymode == CONIO_TTY_PVR) { #ifdef GFX @@ -364,7 +364,7 @@ static void *conio_thread(void *param) { scif_flush(); thd_sleep(1000/60); /* Simulate frame delay */ } - sem_signal(ft_mutex); + sem_signal(&ft_mutex); } conio_exit = -1; return NULL; @@ -401,7 +401,7 @@ int conio_init(int ttymode, int inputmode) { conio_gotoxy(0, 0); } - ft_mutex = sem_create(1); + sem_init(&ft_mutex, 1); /* create the conio thread */ conio_exit = 0; @@ -423,7 +423,7 @@ int conio_shutdown() { ; /* Delete the sempahore */ - sem_destroy(ft_mutex); + sem_destroy(&ft_mutex); #ifdef GFX if (conio_ttymode == CONIO_TTY_PVR) diff --git a/input.c b/input.c index 497c723..22295d0 100644 --- a/input.c +++ b/input.c @@ -41,12 +41,12 @@ typedef struct cb_sem_data_str { struct cb_sem_data_str *next; } cb_sem_data_t; static volatile cb_sem_data_t *cb_queue; -static semaphore_t *cb_sem, *cb_mutex; +static semaphore_t cb_sem, cb_mutex; static volatile int cb_dead; static void input_cb_init() { - cb_sem = sem_create(0); - cb_mutex = sem_create(1); + sem_init(&cb_sem, 0); + sem_init(&cb_mutex, 1); cb_queue = NULL; cb_dead = 0; } @@ -55,13 +55,13 @@ static void cb_default(const char *str) { cb_sem_data_t *t; t = malloc(sizeof(cb_sem_data_t)); - sem_wait(cb_mutex); + sem_wait(&cb_mutex); strncpy(t->line, str, 255); t->line[255] = '\0'; t->next = (cb_sem_data_t *)cb_queue; cb_queue = t; - sem_signal(cb_mutex); + sem_signal(&cb_mutex); - sem_signal(cb_sem); + sem_signal(&cb_sem); } static void input_cb_shutdown() { @@ -76,8 +76,8 @@ static void input_cb_shutdown() { for (i=0; i<5; i++) thd_pass(); - sem_destroy(cb_mutex); - sem_destroy(cb_sem); + sem_destroy(&cb_mutex); + sem_destroy(&cb_sem); for (t=(cb_sem_data_t *)cb_queue; t; t = n) { n = t->next; @@ -99,15 +99,15 @@ int conio_input_getline(int block, char *dst, int dstcnt) { /* Wait for some input to be ready */ if (block > 0) { - if (sem_wait_timed(cb_sem, block) < 0) + if (sem_wait_timed(&cb_sem, block) < 0) return -1; } else { - if (sem_wait(cb_sem) < 0) + if (sem_wait(&cb_sem) < 0) return -1; } /* Grab the mutex and retrieve the line */ - sem_wait(cb_mutex); + sem_wait(&cb_mutex); assert( cb_queue != NULL ); for (l=NULL, t=(cb_sem_data_t *)cb_queue; t->next; t=t->next) l=t; @@ -118,7 +118,7 @@ int conio_input_getline(int block, char *dst, int dstcnt) { } else { cb_queue = NULL; } - sem_signal(cb_mutex); + sem_signal(&cb_mutex); strncpy(dst, t->line, dstcnt-1); dst[dstcnt-1] = '\0'; hooks/post-receive -- A KallistiOS implementation of conio. |