Module: wine Branch: master Commit: d18f0766f72b669eb630371cf4fe4de267dcbc99 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d18f0766f72b669eb630371cf4...
Author: Piotr Caban piotr@codeweavers.com Date: Fri May 20 13:21:29 2011 +0200
msvcrt: Make fflush function thread safe.
---
dlls/msvcrt/file.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index b9c7e90..e6ad5d0 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -774,13 +774,18 @@ int CDECL _flushall(void) */ int CDECL MSVCRT_fflush(MSVCRT_FILE* file) { - if(!file) { - _flushall(); - } else if(file->_flag & MSVCRT__IOWRT) { - int res=msvcrt_flush_buffer(file); - return res; - } - return 0; + if(!file) { + _flushall(); + } else if(file->_flag & MSVCRT__IOWRT) { + int res; + + MSVCRT__lock_file(file); + res = msvcrt_flush_buffer(file); + MSVCRT__unlock_file(file); + + return res; + } + return 0; }
/*********************************************************************