Thread Linux

Implements Thread.

Summary
Thread LinuxImplements Thread.
CopyrightThis program is free software.
Files
C-kern/api/platform/task/thread.hHeader file of Thread.
C-kern/platform/Linux/task/thread.cLinux specific implementation Thread Linux.
thread_startargument_tStartargument of the started system thread.
thread_t
static variables
s_thread_errtimerSimulates an error in <newgroup_thread>.
helper
main_threadThe start function of the thread.
lifetime
synchronize
change-run-state
abort
test
wait_for_signalWaits for a blocked signal until it has been received.
wait_for_signalPolls for a blocked signal.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/platform/task/thread.h

Header file of Thread.

C-kern/platform/Linux/task/thread.c

Linux specific implementation Thread Linux.

thread_startargument_t

struct thread_startargument_t

Startargument of the started system thread.  The function main_thread then calls the main task of the thread which is stored in <thread_t.main>.

thread_t

Summary
static variables
s_thread_errtimerSimulates an error in <newgroup_thread>.
helper
main_threadThe start function of the thread.
lifetime
synchronize
change-run-state
abort
test
wait_for_signalWaits for a blocked signal until it has been received.
wait_for_signalPolls for a blocked signal.

static variables

s_thread_errtimer

static test_errortimer_t s_thread_errtimer

Simulates an error in <newgroup_thread>.

helper

main_thread

static void * main_thread(thread_startargument_t *startarg)

The start function of the thread.  This is the same for all threads.  It initializes signalstack, threadcontext_t, and calls the user supplied main function.

lifetime

synchronize

change-run-state

abort

test

wait_for_signal

static int wait_for_signal(int signr)

Waits for a blocked signal until it has been received.  Implemented with POSIX function <sigwaitinfo>.  Returns 0 if the signal with number signr has been received.

wait_for_signal

Polls for a blocked signal.  Implemented with POSIX function <sigtimedwait>.  Returns 0 if the signal with number signr has been received.

Encapsulates os specific threading model.
Implements Thread.
struct thread_startargument_t
Startargument of the started system thread.
static test_errortimer_t s_thread_errtimer
Simulates an error in newgroup_thread.
static void * main_thread(thread_startargument_t *startarg)
The start function of the thread.
static int wait_for_signal(int signr)
Waits for a blocked signal until it has been received.
Close