]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fflush.c
PDCLIB-16: Add _unlocked variations of all I/O routines; move work into these versions
[pdclib] / functions / stdio / fflush.c
index b8d32ec307d45b389d3a0fa37fb79263998e9f16..df458804dc3099274f024286c3c55db2091418d8 100644 (file)
@@ -13,7 +13,7 @@
 
 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
 
-int fflush( struct _PDCLIB_file_t * stream )
+int fflush_unlocked( struct _PDCLIB_file_t * stream )
 {
     if ( stream == NULL )
     {
@@ -38,6 +38,14 @@ int fflush( struct _PDCLIB_file_t * stream )
         return _PDCLIB_flushbuffer( stream );
     }
 }
+
+int fflush( struct _PDCLIB_file_t * stream )
+{
+    flockfile( stream );
+    int res = fflush_unlocked(stream);
+    funlockfile( stream );
+    return res;
+}
                 
 #endif