On 01/14/2008 04:38 PM, Cyrill Gorcunov wrote:
Jiri, I mean rtc_open() is protected by spinlock+status from being opened simultaneously by a few processes. *But* lets imagine the following situation - this fd (file descriptor) is opened by one multithreaded application so all threads have an access to this fd. Then one thread reads rtc periodically thru unlocked_ioctl and another thread set new time from time to time. So the question I have - is it possible to get second thread stopped at attemption to get rtc spinlock while another thread is setting the new time? Or this situation never-ever could be? i'm not really familiar with process management in Linux and as result could be wrong.
Access to global variable 'rtc' (the rtc itself) is serialized through the spinlock, I see no problem there. If you call read-read-write-read from 4 tasks in userspace, it might be _still_ (no change) reordered to e.g. write-read-read-read by the scheduler.
In fact, the reading process is stopped while the another one is writing the time (due to spinlock).
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/