Is it necessary to ensure the thread-safety when writing a device driver?
PowerMan
powerman1st at gmail.com
Tue Nov 4 08:18:12 UTC 2008
I am writing a uart driver and this uart is used as
the console of my board.
Is it necessary to do some protection in function like that
int uart_write(const char *buf, int len)
{
int i;
for (i = 0; i < len; i++)
TX_Regsiter = buf[i];
}
I worried about that if one thread called printf("abc") and another
called printf("def") then I would got "adbecf".
I noticed that the uart driver of some arm board do nothing to it.
Does the protection is made by the new-lib?
If so, I should only use standard library to access the console,
never directly access the uart_write, right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20081104/201436c8/attachment.html>
More information about the users
mailing list