[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is it necessary to ensure the thread-safety when writing a device driver?
- Date: Tue, 4 Nov 2008 16:18:12 +0800
- From: powerman1st at gmail.com (PowerMan)
- Subject: Is it necessary to ensure the thread-safety when writing a device driver?
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://rtems.rtems.org/pipermail/rtems-users/attachments/20081104/201436c8/attachment.html