Remove references to Haskell 98
[ghc-hetmet.git] / rts / posix / FileLock.c
index e871be5..cb36366 100644 (file)
@@ -2,18 +2,20 @@
  *
  * (c) The GHC Team, 2007
  *
- * File locking support as required by Haskell 98
+ * File locking support as required by Haskell
  *
  * ---------------------------------------------------------------------------*/
  
+#include "PosixSource.h"
 #include "Rts.h"
-#include "Hash.h"
+
 #include "FileLock.h"
+#include "Hash.h"
 #include "RtsUtils.h"
-#include "OSThreads.h"
 
-#include <unistd.h>
+#include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #include <errno.h>
 
 typedef struct {
@@ -52,6 +54,9 @@ initFileLocking(void)
 {
     obj_hash = allocHashTable_(hashLock, cmpLocks);
     fd_hash  = allocHashTable(); /* ordinary word-based table */
+#ifdef THREADED_RTS
+    initMutex(&file_lock_mutex);
+#endif
 }
 
 static void
@@ -65,6 +70,9 @@ freeFileLocking(void)
 {
     freeHashTable(obj_hash, freeLock);
     freeHashTable(fd_hash,  NULL);
+#ifdef THREADED_RTS
+    closeMutex(&file_lock_mutex);
+#endif
 }
 
 int