1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

* threads.c, mit-pthreads.c, list.c, coop.c: Remove K&R

prototypes; just use ANSI C prototypes.  I'm not sure how
mit-pthreads.c ever compiled -- it still doesn't for me, but the
normal make procedure does not try to build it anyway (even
--with-threads I get the other threads code building) so I'm not
too worried about it.
This commit is contained in:
Greg J. Badros 1999-12-19 18:24:12 +00:00
parent 3093947745
commit bccab49811
4 changed files with 1 additions and 259 deletions

View file

@ -40,7 +40,7 @@
* If you do not wish that, delete this exception notice. */
/* $Id: coop.c,v 1.15 1998-11-19 08:15:22 mdj Exp $ */
/* $Id: coop.c,v 1.16 1999-12-19 18:24:12 gjb Exp $ */
/* Cooperative thread library, based on QuickThreads */
@ -62,14 +62,8 @@
/* Queue access functions. */
#ifdef __STDC__
static void
coop_qinit (coop_q_t *q)
#else
static void
coop_qinit (q)
coop_q_t *q;
#endif
{
q->t.next = q->tail = &q->t;
@ -85,14 +79,8 @@ coop_qinit (q)
}
#ifdef __STDC__
coop_t *
coop_qget (coop_q_t *q)
#else
coop_t *
coop_qget (q)
coop_q_t *q;
#endif
{
coop_t *t;
@ -108,30 +96,16 @@ coop_qget (q)
}
#ifdef __STDC__
void
coop_qput (coop_q_t *q, coop_t *t)
#else
void
coop_qput (q, t)
coop_q_t *q;
coop_t *t;
#endif
{
q->tail->next = t;
t->next = &q->t;
q->tail = t;
}
#ifdef __STDC__
static void
coop_all_qput (coop_q_t *q, coop_t *t)
#else
static void
coop_all_qput (q, t)
coop_q_t *q;
coop_t *t;
#endif
{
if (q->t.all_next)
q->t.all_next->all_prev = t;
@ -140,15 +114,8 @@ coop_all_qput (q, t)
q->t.all_next = t;
}
#ifdef __STDC__
static void
coop_all_qremove (coop_q_t *q, coop_t *t)
#else
static void
coop_all_qremove (q, t)
coop_q_t *q;
coop_t *t;
#endif
{
if (t->all_prev)
t->all_prev->all_next = t->all_next;
@ -174,13 +141,8 @@ static void *coop_aborthelp (qt_t *sp, void *old, void *null);
static void *coop_yieldhelp (qt_t *sp, void *old, void *blockq);
#ifdef __STDC__
void
coop_init()
#else
void
coop_init()
#endif
{
coop_qinit (&coop_global_runq);
coop_qinit (&coop_global_sleepq);
@ -195,13 +157,8 @@ coop_init()
return NULL. */
#ifndef GUILE_ISELECT
#ifdef __STDC__
coop_t *
coop_next_runnable_thread()
#else
coop_t *
coop_next_runnable_thread()
#endif
{
int sleepers;
coop_t *t;
@ -231,13 +188,8 @@ coop_next_runnable_thread()
}
#endif
#ifdef __STDC__
void
coop_start()
#else
void
coop_start()
#endif
{
coop_t *next;
@ -248,16 +200,8 @@ coop_start()
}
#ifdef __STDC__
static void *
coop_starthelp (qt_t *old, void *ignore0, void *ignore1)
#else
static void *
coop_starthelp (old, ignore0, ignore1)
qt_t *old;
void *ignore0;
void *ignore1;
#endif
{
coop_global_main.sp = old;
coop_global_main.joining = NULL;
@ -265,28 +209,16 @@ coop_starthelp (old, ignore0, ignore1)
return NULL; /* not used, but keeps compiler happy */
}
#ifdef __STDC__
int
coop_mutex_init (coop_m *m)
#else
int
coop_mutex_init (m)
coop_m *m;
#endif
{
m->owner = NULL;
coop_qinit(&(m->waiting));
return 0;
}
#ifdef __STDC__
int
coop_mutex_lock (coop_m *m)
#else
int
coop_mutex_lock ()
coop_m *m;
#endif
{
if (m->owner == NULL)
{
@ -314,14 +246,8 @@ coop_mutex_lock ()
}
#ifdef __STDC__
int
coop_mutex_unlock (coop_m *m)
#else
int
coop_mutex_unlock (m)
coop_m *m;
#endif
{
coop_t *old, *newthread;
@ -346,41 +272,22 @@ coop_mutex_unlock (m)
}
#ifdef __STDC__
int
coop_mutex_destroy (coop_m *m)
#else
int
coop_mutex_destroy (m)
coop_m *m;
#endif
{
return 0;
}
#ifdef __STDC__
int
coop_condition_variable_init (coop_c *c)
#else
int
coop_condition_variable_init (c)
coop_c *c;
#endif
{
coop_qinit(&(c->waiting));
return 0;
}
#ifdef __STDC__
int
coop_condition_variable_wait_mutex (coop_c *c, coop_m *m)
#else
int
coop_condition_variable_wait_mutex (c, m)
coop_c *c;
coop_m *m;
#endif
{
coop_t *old, *newthread;
@ -411,14 +318,8 @@ coop_condition_variable_wait_mutex (c, m)
}
#ifdef __STDC__
int
coop_condition_variable_signal (coop_c *c)
#else
int
coop_condition_variable_signal (c)
coop_c *c;
#endif
{
coop_t *newthread;
@ -430,28 +331,15 @@ coop_condition_variable_signal (c)
}
#ifdef __STDC__
int
coop_condition_variable_destroy (coop_c *c)
#else
int
coop_condition_variable_destroy (c)
coop_c *c;
#endif
{
return 0;
}
#ifdef __STDC__
coop_t *
coop_create (coop_userf_t *f, void *pu)
#else
coop_t *
coop_create (f, pu)
coop_userf_t *f;
void *pu;
#endif
{
coop_t *t;
void *sto;
@ -472,16 +360,8 @@ coop_create (f, pu)
}
#ifdef __STDC__
static void
coop_only (void *pu, void *pt, qt_userf_t *f)
#else
static void
coop_only (pu. pt, f)
void *pu,
void *pt,
qt_userf_t *f;
#endif
{
coop_global_curr = (coop_t *)pt;
(*(coop_userf_t *)f)(pu);
@ -490,13 +370,8 @@ coop_only (pu. pt, f)
}
#ifdef __STDC__
void
coop_abort ()
#else
void
coop_abort ()
#endif
{
coop_t *old, *newthread;
@ -527,16 +402,8 @@ coop_abort ()
}
#ifdef __STDC__
static void *
coop_aborthelp (qt_t *sp, void *old, void *null)
#else
static void *
coop_aborthelp (sp, old, null)
qt_t *sp;
void *old;
void *null;
#endif
{
coop_t *oldthread = (coop_t *) old;
@ -551,14 +418,8 @@ coop_aborthelp (sp, old, null)
}
#ifdef __STDC__
void
coop_join(coop_t *t)
#else
void
coop_join()
coop_t *t;
#endif
{
coop_t *old, *newthread;
@ -585,13 +446,8 @@ coop_join()
QT_BLOCK (coop_yieldhelp, old, (coop_q_t *) t->joining, newthread->sp);
}
#ifdef __STDC__
void
coop_yield()
#else
void
coop_yield()
#endif
{
coop_t *old = NULL;
coop_t *newthread;
@ -615,16 +471,8 @@ coop_yield()
}
#ifdef __STDC__
static void *
coop_yieldhelp (qt_t *sp, void *old, void *blockq)
#else
static void *
coop_yieldhelp (sp, old, blockq)
qt_t *sp;
void *old;
void *blockq;
#endif
{
((coop_t *)old)->sp = sp;
coop_qput ((coop_q_t *)blockq, (coop_t *)old);

View file

@ -62,15 +62,8 @@
/* creating lists */
/* SCM_P won't help us deal with varargs here. */
#ifdef __STDC__
SCM
scm_listify (SCM elt, ...)
#else
SCM
scm_listify (elt, va_alist)
SCM elt;
va_dcl
#endif
{
va_list foo;
SCM answer;

View file

@ -56,41 +56,23 @@ static queue infos = { &infos, &infos }; /* the dequeue of info structures */
/* Key to thread specific data */
pthread_key_t info_key;
#ifdef __STDC__
size_t
scm_threads_free_thread (SCM t)
#else
size_t
scm_threads_free_thread (t)
SCM t;
#endif
{
scm_must_free (SCM_THREAD_DATA (t));
return sizeof (pthread_t);
}
#ifdef __STDC__
size_t
scm_threads_free_mutex (SCM m)
#else
size_t
scm_threads_free_mutex (m)
SCM m;
#endif
{
pthread_mutex_destroy (SCM_MUTEX_DATA (m));
scm_must_free (SCM_MUTEX_DATA (m));
return sizeof (pthread_mutex_t);
}
#ifdef __STDC__
size_t
scm_threads_free_condvar (SCM c)
#else
size_t
scm_threads_free_condvar (c)
SCM c;
#endif
{
pthread_cond_destroy (SCM_CONDVAR_DATA (c));
scm_must_free (SCM_CONDVAR_DATA (c));
@ -99,14 +81,8 @@ scm_threads_free_condvar (c)
/* cleanup for info structure
*/
#ifdef __STDC__
static void
scm_pthread_delete_info (void *ptr)
#else
static void
scm_pthread_delete_info (ptr)
void *ptr;
#endif
{
scm_pthread_info *info = (scm_pthread_info *) ptr;
info->q.blink->flink = info->q.flink;
@ -114,14 +90,8 @@ scm_pthread_delete_info (ptr)
scm_must_free ((char *) info);
}
#ifdef __STDC__
void
scm_threads_init (SCM_STACKITEM *i)
#else
void
scm_threads_init (i)
SCM_STACKITEM *i;
#endif
{
/*
* each info structure is made thread-specific, so that the cleanup
@ -167,13 +137,8 @@ static scm_pthread_info *pthreads_find_info (pthread_t target)
}
}
#ifdef __STDC__
void
scm_threads_mark_stacks ()
#else
void
scm_threads_mark_stacks ()
#endif
{
scm_pthread_info *info;
pthread_t thread;
@ -259,14 +224,8 @@ scm_threads_mark_stacks ()
}
}
#ifdef __STDC__
void *
launch_thread (void *p)
#else
void *
launch_thread (p)
void *p;
#endif
{
/* The thread object will be GC protected by being a member of the
list given as argument to launch_thread. It will be marked
@ -279,14 +238,8 @@ launch_thread (p)
return NULL;
}
#ifdef __STDC__
SCM
scm_call_with_new_thread (SCM argl)
#else
SCM
scm_call_with_new_thread (argl)
SCM argl;
#endif
{
SCM thread;
@ -369,39 +322,23 @@ scm_call_with_new_thread (argl)
return thread;
}
#ifdef __STDC__
SCM
scm_join_thread (SCM t)
#else
SCM
scm_join_thread (t)
SCM t;
#endif
{
void *value;
pthread_join (SCM_THREAD_DATA (t), &value);
return SCM_BOOL_T;
}
#ifdef __STDC__
SCM
scm_yield ()
#else
SCM
scm_yield ()
#endif
{
pthread_yield ();
return SCM_BOOL_T;
}
#ifdef __STDC__
SCM
scm_make_mutex ()
#else
SCM
scm_make_mutex ()
#endif
{
SCM m;
pthread_mutex_t *data = (pthread_mutex_t *) scm_must_malloc (sizeof (pthread_mutex_t), "mutex");
@ -410,41 +347,24 @@ scm_make_mutex ()
return m;
}
#ifdef __STDC__
SCM
scm_lock_mutex (SCM m)
#else
SCM
scm_lock_mutex (m)
SCM m;
#endif
{
SCM_ASSERT (SCM_MUTEXP (m), m, SCM_ARG1, s_lock_mutex);
pthread_mutex_lock (SCM_MUTEX_DATA (m));
return SCM_BOOL_T;
}
#ifdef __STDC__
SCM
scm_unlock_mutex (SCM m)
#else
SCM
scm_unlock_mutex (m)
SCM m;
#endif
{
SCM_ASSERT (SCM_MUTEXP (m), m, SCM_ARG1, s_unlock_mutex);
pthread_mutex_unlock (SCM_MUTEX_DATA (m));
return SCM_BOOL_T;
}
#ifdef __STDC__
SCM
scm_make_condition_variable ()
#else
SCM
scm_make_condition_variable ()
#endif
{
SCM c;
pthread_cond_t *data = (pthread_cond_t *) scm_must_malloc (sizeof (pthread_cond_t), "condvar");
@ -453,15 +373,8 @@ scm_make_condition_variable ()
return c;
}
#ifdef __STDC__
SCM
scm_wait_condition_variable (SCM c, SCM m)
#else
SCM
scm_wait_condition_variable (c, m)
SCM c;
SCM m;
#endif
{
SCM_ASSERT (SCM_CONDVARP (c),
c,
@ -475,14 +388,8 @@ scm_wait_condition_variable (c, m)
return SCM_BOOL_T;
}
#ifdef __STDC__
SCM
scm_signal_condition_variable (SCM c)
#else
SCM
scm_signal_condition_variable (c)
SCM c;
#endif
{
SCM_ASSERT (SCM_CONDVARP (c),
c,

View file

@ -145,14 +145,8 @@ SCM_REGISTER_PROC(s_signal_condition_variable, "signal-condition-variable", 1, 0
#ifdef __STDC__
void
scm_init_threads (SCM_STACKITEM *i)
#else
void
scm_init_threads (i)
SCM_STACKITEM *i;
#endif
{
scm_tc16_thread = scm_make_smob_type ("thread", sizeof (coop_t));
scm_tc16_mutex = scm_make_smob_type ("mutex", sizeof (coop_m));