This includes support for preemption ready to be integrated into
exception handlers.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Preemption was supposed to be supported, but it had no means of safely
updating the state of a thread, so mt_exec() could fail to resume a
preempted thread.
mt_exec() is allowed to be called only from the main Contiki thread, so
the mt threads passed to it may be only ready or exited, not running.
Consequently, there is no need for a distinction between the ready and
running states, so merge them as a started state, which avoids having to
update the state of a thread upon preemption.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
If mt_yield() needs it, then mt_exit() too. A thread could indeed be
preempted while calling mt_exit().
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Compiling examples/er-rest-example for the avr-raven gives:
integer overflow in expression [-Woverflow]
On the AVR int is 16 bit and some calculations may overflow.
This happens for example with multiplications involving
CLOCK_SECOND where all the operands are of type int.
Casting one of the operands to clock_time_t forces
the arithmetic to clock_time_t without increasing the size
of the program (the calculation is performed at compile time).
Some arguments passed to the functions disabled with
LPM_CONF_ENABLE == 0 could trigger build warnings because they became
unused with this configuration option. Disable these functions by using
empty static inline functions instead of empty macros, so that the
function arguments are always considered by the compiler as used,
without having to #if-out code in many places.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
The log function writes directly to the screen. Combined with the usage of PFS this means that the POSIX layer of the C library isn't referenced anymore thus reducing the memory requirements.
The recently added doesclrscrafterexit() allows cc65 programs to determine if the screen will be cleared after exit(). If that isn't the case then there's no need to ask the user to press a key in order to allow him to read the final program output.
Plain text in the HTML header (think of <title>text</title>) is collected as usual. The decision to discard it is triggered by the first withspace following. In the usual case of the <body> no preceeded by any whitespace this means that by the point the first whitespace is encountered we're not in "discard mode" anymore and therefore incorrectly render the text.
Explicitly calling do_word() just before leaving "discard mode" discards all text collected so far.