Moved exclusion logic to a higher level so that printf output is more readable when the same stdout FILE* is shared

by many pthreads (tasks did not have this probablem because they have separate stdout streams).


git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@174 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-03-29 14:21:31 +00:00
parent b1d5b6899a
commit 8b9fcf354e
4 changed files with 19 additions and 16 deletions

View File

@ -98,6 +98,9 @@
task_delete() can cause pending tasks to be merged and a task_delete() can cause pending tasks to be merged and a
context switch to occur. context switch to occur.
* Added mq_timedreceive() and mq_timedsend() * Added mq_timedreceive() and mq_timedsend()
* signal mask is now inherited by both child tasks and threads.
* Improved sharebility of stdout among pthreads (only). Nothing
was broken, but by moving the mutual exclusion logic to a
higher level, the printf output is more readable.
* Started m68322 * Started m68322

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: March 21, 2007</p> <p>Last Updated: March 28, 2007</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -459,6 +459,10 @@ Other memory:
task_delete() can cause pending tasks to be merged and a task_delete() can cause pending tasks to be merged and a
context switch to occur. context switch to occur.
* Added mq_timedreceive() and mq_timedsend() * Added mq_timedreceive() and mq_timedsend()
* signal mask is now inherited by both child tasks and threads.
* Improved sharebility of stdout among pthreads (only). Nothing
was broken, but by moving the mutual exclusion logic to a
higher level, the printf output is more readable.
* Started m68322 * Started m68322
</pre></ul> </pre></ul>

16
TODO
View File

@ -1,9 +1,7 @@
NuttX TODO List NuttX TODO List
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
Task/Scheduler o Task/Scheduler
^^^^^^^^^^^^^^
- When a tasks exits, shouldn't all of its child pthreads also be terminated? - When a tasks exits, shouldn't all of its child pthreads also be terminated?
- Should task_delete() cause atexit() function to be called? - Should task_delete() cause atexit() function to be called?
- Implement sys/mman.h and functions - Implement sys/mman.h and functions
@ -27,16 +25,6 @@ o pthreads
- pthread_cancel(): Should implemenent cancellation points and pthread_testcancel() - pthread_cancel(): Should implemenent cancellation points and pthread_testcancel()
o Libraries o Libraries
- There seems to be some kind of failure in the mutual exclusion logic on
buffered, "standard," IO.
- If two threads try fflush-ing at the same time, there is corruption
of the output.
- Yhere is a failure in the examples/ostest POSIX timer
test when CONFIG_DEBUG is enabled. This is almost certainly yet
another case where printf (or its kin) are being called from a
sensitive area in the OS.
- I am now seeing the same thing with the dm320 barrier test.
Apparently printf has some thread safety issues.
o File system o File system
- Add some concept like mount points to handle mounted "real" filesystems. - Add some concept like mount points to handle mounted "real" filesystems.
@ -63,7 +51,7 @@ o C5471
o DM320 o DM320
o pjrc-8052 / MCS51 o pjrc-8052 / MCS51
* Current status: - Current status:
- Basic OS task management seems OK - Basic OS task management seems OK
- Fails when interrupts enabled. The stack pointer is around 0x6e - Fails when interrupts enabled. The stack pointer is around 0x6e
before the failure occurs. It looks like some issue when the before the failure occurs. It looks like some issue when the

View File

@ -87,7 +87,15 @@ int vfprintf(FILE *stream, const char *fmt, va_list ap)
*/ */
lib_stdstream(&stdstream, stream); lib_stdstream(&stdstream, stream);
/* Hold the stream semaphore throughout the lib_vsprintf
* call so that this thread can get its entire message out
* before being pre-empted by the next thread.
*/
lib_take_semaphore(stream);
n = lib_vsprintf(&stdstream.public, fmt, ap); n = lib_vsprintf(&stdstream.public, fmt, ap);
lib_give_semaphore(stream);
} }
return n; return n;
} }