LINUX.ORG.RU

История изменений

Исправление KennyMinigun, (текущая версия) :

А вот еще страничка мануала про flockfile() из GLIBC: http://man7.org/linux/man-pages/man3/flockfile.3.html

The stdio functions are thread-safe. This is achieved by assigning to each FILE object a lockcount and (if the lockcount is nonzero) an owning thread.

All this is invisible to the C-programmer, but there may be two reasons to wish for more detailed control. On the one hand, maybe a series of I/O actions by one thread belongs together, and should not be interrupted by the I/O of some other thread. On the other hand, maybe the locking overhead should be avoided for greater efficiency.

Блин, нужно теперь стандарт читать :(

Исходная версия KennyMinigun, :

А вот еще страничка мануала про flockfile() из GLIBC: http://man7.org/linux/man-pages/man3/flockfile.3.html

The stdio functions are thread-safe. This is achieved by assigning to each FILE object a lockcount and (if the lockcount is nonzero) an owning thread.

All this is invisible to the C-programmer, but there may be two reasons to wish for more detailed control. On the one hand, maybe a series of I/O actions by one thread belongs together, and should not be interrupted by the I/O of some other thread. On the other hand, maybe the locking overhead should be avoided for greater efficiency.