summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-04-05 19:27:25 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-04-05 19:27:25 +0900
commit8e40065311f46b32675f3391919f95228b07efd4 (patch)
treeaada1ecafbe1b786da6d0381a5bf75a42ddedb9d
parenta99c5c60485f7af2b62f8839ebb04605e15a7f9b (diff)
Initialization of chx_spinlock
-rw-r--r--ChangeLog4
-rw-r--r--chopstx.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ab0c9b8..789ad09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
2016-04-05 Niibe Yutaka <gniibe@fsij.org>
* chopstx.c (struct NVIC): Add volatile qualifier to members.
+ (chx_spin_init): New.
+ (chopstx_mutex_init, chopstx_cond_init): Call chx_spin_init.
+ (chx_init): Initialize the spinlocks for INTR_LOCK, Q_READY,
+ Q_TIMER, and Q_JOIN.
2016-03-08 Niibe Yutaka <gniibe@fsij.org>
diff --git a/chopstx.c b/chopstx.c
index 3ef4353..caa628e 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -245,6 +245,11 @@ static void chx_timer_insert (struct chx_thread *tp, uint32_t usec);
/**************/
+static void chx_spin_init (struct chx_spinlock *lk)
+{
+ (void)lk;
+}
+
static void chx_spin_lock (struct chx_spinlock *lk)
{
(void)lk;
@@ -625,11 +630,15 @@ chopstx_t chopstx_main;
void
chx_init (struct chx_thread *tp)
{
+ chx_spin_init (&intr_lock);
chx_prio_init ();
memset (&tp->tc, 0, sizeof (tp->tc));
q_ready.next = q_ready.prev = (struct chx_thread *)&q_ready;
+ chx_spin_init (&q_ready.lock);
q_timer.next = q_timer.prev = (struct chx_thread *)&q_timer;
+ chx_spin_init (&q_timer.lock);
q_join.next = q_join.prev = (struct chx_thread *)&q_join;
+ chx_spin_init (&q_join.lock);
tp->next = tp->prev = tp;
tp->mutex_list = NULL;
tp->clp = NULL;
@@ -894,6 +903,7 @@ chopstx_usec_wait (uint32_t usec)
void
chopstx_mutex_init (chopstx_mutex_t *mutex)
{
+ chx_spin_init (&mutex->lock);
mutex->q.next = mutex->q.prev = (struct chx_thread *)mutex;
mutex->list = NULL;
}
@@ -1001,6 +1011,7 @@ chopstx_mutex_unlock (chopstx_mutex_t *mutex)
void
chopstx_cond_init (chopstx_cond_t *cond)
{
+ chx_spin_init (&cond->lock);
cond->q.next = cond->q.prev = (struct chx_thread *)cond;
}