]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fclose.c
PDCLIB-8: First phase of intergation of new I/O backend system (with minimal
[pdclib] / functions / stdio / fclose.c
index 113845b83211294ff9cfa23d332bdf7bb4ef038a..3d9e25724f45bdf58de3ee14ba16d183af0bb0fa 100644 (file)
@@ -12,6 +12,7 @@
 
 #ifndef REGTEST
 #include <_PDCLIB_glue.h>
+#include <threads.h>
 
 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
 
@@ -33,8 +34,13 @@ int fclose( struct _PDCLIB_file_t * stream )
                     return EOF;
                 }
             }
+
+            /* Release mutex*/
+            mtx_destroy( &stream->lock );
+
             /* Close handle */
-            _PDCLIB_close( stream->handle );
+            stream->ops->close(stream->handle);
+
             /* Remove stream from list */
             if ( previous != NULL )
             {
@@ -83,7 +89,7 @@ int main( void )
     TESTCASE( _PDCLIB_filelist == file2 );
     TESTCASE( fclose( file2 ) == 0 );
     TESTCASE( _PDCLIB_filelist == file1 );
-    TESTCASE( ( file2 = fopen( testfile1, "w" ) ) != NULL );
+    TESTCASE( ( file2 = fopen( testfile2, "w" ) ) != NULL );
     TESTCASE( _PDCLIB_filelist == file2 );
     TESTCASE( fclose( file1 ) == 0 );
     TESTCASE( _PDCLIB_filelist == file2 );