on master help sign in
Merge branch '145_leaking_fds' of https://github.com/agentm/project-m36 into 145_leaking_fds
commitaa730ee683243ef91b674543c216fb9289efd6d5 authorAgentM <agentm@themactionfaction.com> dateMon 18 Sep 2017, 22:59 (9 years ago) parent4f1a9951834b66
3 files changed+31−1
project-m36.cabal+17 src/lib/ProjectM36/FileLock.hs+10 stack.yaml+4−1
project-m36.cabal+17
@@ -510,6 +510,23 @@ Executable handles
510510 Default-Extensions: OverloadedStrings
511511 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, optparse-applicative, stm-containers, list-t, ghc, ghc-paths, transformers, project-m36, random, MonadRandom, semigroups
512512 main-is: benchmark/Handles.hs
513+ Other-Modules: TutorialD.Interpreter,
514+ TutorialD.Interpreter.Base,
515+ TutorialD.Interpreter.DatabaseContextExpr,
516+ TutorialD.Interpreter.DatabaseContextIOOperator,
517+ TutorialD.Interpreter.Export.Base,
518+ TutorialD.Interpreter.Export.CSV,
519+ TutorialD.Interpreter.Import.Base,
520+ TutorialD.Interpreter.Import.BasicExamples,
521+ TutorialD.Interpreter.Import.CSV,
522+ TutorialD.Interpreter.Import.TutorialD,
523+ TutorialD.Interpreter.InformationOperator,
524+ TutorialD.Interpreter.RODatabaseContextOperator,
525+ TutorialD.Interpreter.RelationalExpr,
526+ TutorialD.Interpreter.SchemaOperator,
527+ TutorialD.Interpreter.TransGraphRelationalOperator,
528+ TutorialD.Interpreter.TransactionGraphOperator,
529+ TutorialD.Interpreter.Types
513530 GHC-Options: -Wall -threaded -rtsopts
514531 HS-Source-Dirs: ./src/bin
515532 if flag(profiler)
src/lib/ProjectM36/FileLock.hs+10
@@ -24,6 +24,16 @@ foreign import WINDOWS_CCONV "LockFileEx" c_lockFileEx :: HANDLE -> DWORD -> DWO
2424
2525foreign import WINDOWS_CCONV "UnlockFileEx" c_unlockFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> LPOVERLAPPED -> IO BOOL
2626
27+type LockFile = Handle
28+
29+openLockFile :: FilePath -> IO LockFile
30+openLockFile path = openFile path ReadMode
31+
32+closeLockFile :: LockFile -> IO ()
33+closeLockFile file = do
34+ unlockFile file
35+ hClose file
36+
2737--swiped from System.FileLock package
2838lockFile :: Handle -> LockType -> IO ()
2939lockFile handle lock = withHandleToHANDLE handle $ \winHandle -> do
stack.yaml+4−1
@@ -14,7 +14,7 @@ extra-deps:
1414- extended-reals-0.2.1.0
1515- gnuplot-0.5.4.1
1616- text-1.2.2.1
17−- uuid-aeson-0.1.0.0
17+- aeson-1.2.1.00
1818- distributed-process-0.6.6
1919- distributed-process-async-0.2.4
2020- distributed-process-client-server-0.2.3
@@ -43,3 +43,6 @@ extra-package-dbs: []
4343
4444# Allow a newer minor version of GHC than the snapshot specifies
4545# compiler-check: newer-minor
46+
47+allow-newer: true
48+