Commit Graph

77 Commits (13832d8e621027bfbd636b32d4c29ede32178e9d)

Author SHA1 Message Date
Joakim Gebart 13832d8e62 everything: Remove filename from @file Doxygen command 8 years ago
Kaspar Schleiser c944d54171 core: log: introduce logging API 8 years ago
René Kijewski 310ea35018 Don't evaluate inISR() if not needed 9 years ago
René Kijewski 370f926bad core: `sched_switch()` switch if not on runqueue
Fixes #1935.

`sched_switch()` should not only switch if the other priority is higher,
but also if the current thread was moved from the runqueue.
9 years ago
Ludwig Ortmann 86189d600e core: remove remaining dINT occurences 9 years ago
Ludwig Ortmann e4fec18bdc core/sched: unify DEBUG text syntax, nomenclature 9 years ago
René Kijewski 12d157247c core: sched.c did not compile with DEBUG=1 9 years ago
Kaspar Schleiser feb550f17a Merge pull request #1885 from OlegHahm/thread_yield_higher_cleanup
core: thread_yield_higher cleanup
9 years ago
René Kijewski 9ddbf57709 core: refactor sched_run
`sched_run()` was cluttered. Many individual changes were done without a
proper refactoring.
9 years ago
Oleg Hahm 93ac114bc3 core: move thread_yield*() to thread.[ch]
Although it might conceptionally rather belong to the scheduler, the
yield functions are prefixed with thread_ and thus, belong there.
9 years ago
Oleg Hahm 6f53cd484d core: make sched_runqueue public
Reverting b604832, because thread_yield() needs to access this
information.
9 years ago
René Kijewski 677d690e2b core: introduce thread_yield_higher(), yield less
Fixes #1708.

Currently involuntary preemption causes the current thread not only to
yield for a higher prioritized thread, but all other threads of its own
priority class, too.

This PR adds the function `thread_yield_higher()`, which will yield the
current thread in favor of higher prioritized functions, but not for
threads of its own priority class.

Boards now need to implement `thread_yield_higher()` instead of
`thread_yield()`, but `COREIF_NG` boards are not affected in any way.

`thread_yield()` retains its old meaning: yield for every thread that
has the same or a higher priority.

This PR does not touch the occurrences of `thread_yield()` in the periph
drivers, because the author of this PR did not look into the logic of
the various driver implementations.
9 years ago
René Kijewski c0ce346a12 cppcheck: don't needlessly assign sched_active_pid 9 years ago
René Kijewski b604832777 core: make sched_runqueues static
PR #1000 overlooked to rename `runqueues` into `sched_runqueues` in
 `sched.h`. This shows that the variable is not used outside of
 `sched.c`.

 As the list should not be accessed outside of the scheduler, so it
 can be `static`.
9 years ago
René Kijewski 1df0b5644a core: sched_switch only switch for higher priority
sched_switch() is called by some library functions when a call unblocks
another thread. Then it needs to be tested if the current thread should
be preempted for the newly runnable thread.

A non-volutarily yield should only happen if the unblocked thread has a
_higher_ priority than the current thread. The current implementation,
which tests if the other thread has the same or a higher priority, does
not fit the documentation.
9 years ago
Kaspar Schleiser 003dd1969c Merge pull request #1566 from Kijewski/undef_is_null
core: let PIDs begin with 1
9 years ago
René Kijewski a5c9d4572d core: clist without explicit thread
Right now the core component `clist` is a generic cyclic doubly-linked list.
In the core it is used in `tcb_t::rq_entry`.
Further it is used `net_if.c`.

This commit removes the member `clist_node_t::data` which stored the
pointer to the `tcb_t` instance of which the clist is already a member.
The needless member added `sizeof (int)` bytes to every instance of
`tcb_t`.

In `net_if.c` the clist was used in a type-punned way, so that the
change won't affect it.
9 years ago
René Kijewski 2cb4166c3e all over the place: use sched_active_pid
In many places we needlessly use `sched_active_thread->pid` whilst we
already have `sched_active_pid` with the same value, and one less
indirection.

`thread_getpid()` is made `static inline` so that there is no penalty in
using this function over accessing `sched_active_pid` directly.
9 years ago
René Kijewski 427a5fbaef core: let valid PIDs start with 1 9 years ago
Oleg Hahm c2b0423918 core: renamed KERNEL_PID_NULL to KERNEL_PID_UNDEF
As @authmillenon pointed out the "null" in the old name is somewhat
misleading, since the actual value is -1.
9 years ago
Oleg Hahm 983d056c75 core: harmonizes the data type for the process ID
Instead of using differing integer types use kernel_pid_t for process
identifier. This type is introduced in a new header file to avoid
circular dependencies.
9 years ago
Ludwig Ortmann 3ca4f18479 doc: use lgplv2.1-short license header instead of lgpl-short-riot 9 years ago
Ludwig Ortmann b6846e31fc doc: fix most occurences of FU as an author
.. but only if there are other authors as well
9 years ago
Ludwig Ortmann a585eaf752 core/sched: remove MODULE_NSS helpers (API CHANGE)
remove thread_getlastpid and last_pid from the API, it is unused
9 years ago
Ludwig Ortmann 147c285365 core/sched: fix pid/tcb & refactor SCHEDSTATISTICS
pid and tcb_t were compared instead of pid and pid

SCHEDSTATISTICS:
- reduce hwtimer_now calls
- dont use thread_last_pid anymore
- increase readability
9 years ago
Ludwig Ortmann 9cabdb3043 core/sched: clean up
- remove stray spaces
- remove TODOs:
    - MODULE_HWTIMER is not a module anymore
    - checking for NULL is necessary, at least without API changes:
      `sched_task_exit` sets `sched_active_thread` to `NULL`, then exits,
      afterwards `cpu_switch_context_exit` calls `sched_run`
9 years ago
René Kijewski a21c3f45bc core: remove unnecessary tests in sched.c
The scheduling gets activated by `kernel_init()` calling
`cpu_switch_context_exit()`. Before this `sched_run()` won't be called.
When it gets called, at least the main thread and the idle thread are
spawned. The idle thread won't die / get killed. So there always is at
least one thread in `runqueue_bitcache`.

Closes #19.
9 years ago
René Kijewski 05a4bf7f04 Merge pull request #1057 from Kijewski/sched_switch-current_prio
core: imply current_prio in `sched_switch()`
9 years ago
Martin Lenders 2362623490 Fix trailing whitespaces
Fixes #1138
9 years ago
René Kijewski a6fd5bff92 core: imply current_prio in `sched_switch()`
There is no need to supply the current priority to `sched_switch()`,
when this function can easily tell the value of
`active_thread->priority` itself.
9 years ago
Oleg Hahm ef5ec344fd core: prefix API functions correctly
Also changed names for bitarithm functions and rename thread_pid to sched_active_pid.
9 years ago
Oleg Hahm 5d7f7dd686 Merge pull request #1079 from BytesGalore/add_NORETURNs
core: and cpu: Added NORETURN to functions that should not return
10 years ago
René Kijewski 9a9caf2c68 Exterminate old-style function definitions 10 years ago
Hauke Petersen 608afc4777 Introduced a cleaned-up cpu/core interface
- Included a collection of cpu-dependent headers in core/include/arch
- Extracted all interfaces that need to be implemented for a cpu
- Created a mapping between those interfaces and the old ones
- added flag for disabling arch interface
- added missing state to lpm_arch interface
- added arch interface for reboot
- fixed newline issues that were pointed out
- documentation fixes to cpu-core interface
10 years ago
Martin 4e73169b38 added NORETURNs to functions that should not return
and added `UNREACHABLE();` to hint the compiler unreachable lines

added right signature for first parameter of `thread_stack_init()`
added `UNREACHABLE();` macro to `cpu/lpc1768/atom.c` and `cpu/msp430-common/cpu.c`
10 years ago
Oleg Hahm 25a2122f83 core: documentation: updated, improved, and completed doxygen comments 10 years ago
René Kijewski 83988b2d03 Merge pull request #725 from kaspar030/optimize_thread_status_usage
core: sched: thread: optimize thread status field usage
10 years ago
Oleg Hahm 32f918abe8 simplified sched_switch
sched_switch can check ISR itself.
10 years ago
Oleg Hahm 24f5ec929c removed duplicate inISR prototype 10 years ago
Kaspar Schleiser 36981c95b9 core: sched: thread: optimize thread status field usage
see PR #716 for discussion
10 years ago
Christian Mehlis 3dce0cbb97 Merge pull request #662 from Kijewski/remove-sched_init
Do not zero out sched_threads needlessly
10 years ago
Ludwig Ortmann 2525920426 remove trailing whitespace and newlines 10 years ago
René Kijewski 7e685d6b36 Do not zero out sched_threads needlessly
The function sched_init() zeroes out sched_threads needlessly. All
static variables can be assumed to be initialized with zero, anyways.
The C standard mandates it, and all at other places in the code it is
assumed.
10 years ago
Kaspar Schleiser 56ee585c81 update Kaspar's email address
kaspar.schleiser@fu-berlin.de is obsolete.
(2nd try, first try was overwritten by some overzealous documenter)
10 years ago
Oleg Hahm 903ec54a43 making include directives consistent 10 years ago
Oleg Hahm 9eb1daf31e added thread.h include (necessary since 227c847135) 10 years ago
Hauke Petersen edcabf7cb6 Fixed a lot of comments by removing tabs and correcting format. 10 years ago
Hauke Petersen 3785fe956b Fixed doxygen comments, focused on file headers and group definitions 10 years ago
Kaspar Schleiser f85adf608f change my email address
kaspar.schleiser@fu-berlin.de will be obsoleted soon. Replace it with
kaspar@schleiser.de, which will (hopefully) stay.
10 years ago
Ludwig Ortmann d6c213fb47 fix grammar in license header 10 years ago