Skip to content

Commit 87c72a8

Browse files
committed
core/thread: unify thread_t variable naming
thread_t variables were named t, other_thread, cb. For consistency sake, change all occurences to just "thread".
1 parent 98f97af commit 87c72a8

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

core/thread.c

+26-26
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ volatile thread_t *thread_get(kernel_pid_t pid)
4040

4141
int thread_getstatus(kernel_pid_t pid)
4242
{
43-
volatile thread_t *t = thread_get(pid);
44-
return t ? (int)t->status : (int)STATUS_NOT_FOUND;
43+
volatile thread_t *thread = thread_get(pid);
44+
return thread ? (int)thread->status : (int)STATUS_NOT_FOUND;
4545
}
4646

4747
const char *thread_getname(kernel_pid_t pid)
4848
{
4949
#ifdef DEVELHELP
50-
volatile thread_t *t = thread_get(pid);
51-
return t ? t->name : NULL;
50+
volatile thread_t *thread = thread_get(pid);
51+
return thread ? thread->name : NULL;
5252
#else
5353
(void)pid;
5454
return NULL;
@@ -73,18 +73,18 @@ int thread_wakeup(kernel_pid_t pid)
7373

7474
unsigned old_state = irq_disable();
7575

76-
thread_t *other_thread = (thread_t *) thread_get(pid);
76+
thread_t *thread = (thread_t *) thread_get(pid);
7777

78-
if (!other_thread) {
78+
if (!thread) {
7979
DEBUG("thread_wakeup: Thread does not exist!\n");
8080
}
81-
else if (other_thread->status == STATUS_SLEEPING) {
81+
else if (thread->status == STATUS_SLEEPING) {
8282
DEBUG("thread_wakeup: Thread is sleeping.\n");
8383

84-
sched_set_status(other_thread, STATUS_RUNNING);
84+
sched_set_status(thread, STATUS_RUNNING);
8585

8686
irq_restore(old_state);
87-
sched_switch(other_thread->priority);
87+
sched_switch(thread->priority);
8888

8989
return 1;
9090
}
@@ -173,7 +173,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
173173
DEBUG("thread_create: stacksize is too small!\n");
174174
}
175175
/* allocate our thread control block at the top of our stackspace */
176-
thread_t *cb = (thread_t *) (stack + stacksize);
176+
thread_t *thread = (thread_t *) (stack + stacksize);
177177

178178
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK)
179179
if (flags & THREAD_CREATE_STACKTEST) {
@@ -209,41 +209,41 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
209209
return -EOVERFLOW;
210210
}
211211

212-
sched_threads[pid] = cb;
212+
sched_threads[pid] = thread;
213213

214-
cb->pid = pid;
215-
cb->sp = thread_stack_init(function, arg, stack, stacksize);
214+
thread->pid = pid;
215+
thread->sp = thread_stack_init(function, arg, stack, stacksize);
216216

217217
#if defined(DEVELHELP) || defined(SCHED_TEST_STACK) || defined(MODULE_MPU_STACK_GUARD)
218-
cb->stack_start = stack;
218+
thread->stack_start = stack;
219219
#endif
220220

221221
#ifdef DEVELHELP
222-
cb->stack_size = total_stacksize;
223-
cb->name = name;
222+
thread->stack_size = total_stacksize;
223+
thread->name = name;
224224
#endif
225225

226-
cb->priority = priority;
227-
cb->status = STATUS_STOPPED;
226+
thread->priority = priority;
227+
thread->status = STATUS_STOPPED;
228228

229-
cb->rq_entry.next = NULL;
229+
thread->rq_entry.next = NULL;
230230

231231
#ifdef MODULE_CORE_MSG
232-
cb->wait_data = NULL;
233-
cb->msg_waiters.next = NULL;
234-
cib_init(&(cb->msg_queue), 0);
235-
cb->msg_array = NULL;
232+
thread->wait_data = NULL;
233+
thread->msg_waiters.next = NULL;
234+
cib_init(&(thread->msg_queue), 0);
235+
thread->msg_array = NULL;
236236
#endif
237237

238238
sched_num_threads++;
239239

240-
DEBUG("Created thread %s. PID: %" PRIkernel_pid ". Priority: %u.\n", name, cb->pid, priority);
240+
DEBUG("Created thread %s. PID: %" PRIkernel_pid ". Priority: %u.\n", name, thread->pid, priority);
241241

242242
if (flags & THREAD_CREATE_SLEEPING) {
243-
sched_set_status(cb, STATUS_SLEEPING);
243+
sched_set_status(thread, STATUS_SLEEPING);
244244
}
245245
else {
246-
sched_set_status(cb, STATUS_PENDING);
246+
sched_set_status(thread, STATUS_PENDING);
247247

248248
if (!(flags & THREAD_CREATE_WOUT_YIELD)) {
249249
irq_restore(state);

0 commit comments

Comments
 (0)