on master help sign in
Merge branch '145_leaking_fds' of https://github.com/agentm/project-m36 into 145_leaking_fds
aa730eeAgentM
project-m36.cabal+17
@@ -510,6 +510,23 @@ Executable handles
510 Default-Extensions: OverloadedStrings
510 Default-Extensions: OverloadedStrings
511 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
511 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
512 main-is: benchmark/Handles.hs
512 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
513 GHC-Options: -Wall -threaded -rtsopts
530 GHC-Options: -Wall -threaded -rtsopts
514 HS-Source-Dirs: ./src/bin
531 HS-Source-Dirs: ./src/bin
515 if flag(profiler)
532 if flag(profiler)
src/lib/ProjectM36/FileLock.hs+10
@@ -24,6 +24,16 @@ foreign import WINDOWS_CCONV "LockFileEx" c_lockFileEx :: HANDLE -> DWORD -> DWO
24
24
25foreign import WINDOWS_CCONV "UnlockFileEx" c_unlockFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> LPOVERLAPPED -> IO BOOL
25foreign import WINDOWS_CCONV "UnlockFileEx" c_unlockFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> LPOVERLAPPED -> IO BOOL
26
26
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+
27--swiped from System.FileLock package
37--swiped from System.FileLock package
28lockFile :: Handle -> LockType -> IO ()
38lockFile :: Handle -> LockType -> IO ()
29lockFile handle lock = withHandleToHANDLE handle $ \winHandle -> do
39lockFile handle lock = withHandleToHANDLE handle $ \winHandle -> do
stack.yaml+4−1
@@ -14,7 +14,7 @@ extra-deps:
14- extended-reals-0.2.1.0
14- extended-reals-0.2.1.0
15- gnuplot-0.5.4.1
15- gnuplot-0.5.4.1
16- text-1.2.2.1
16- text-1.2.2.1
17−- uuid-aeson-0.1.0.0
17+- aeson-1.2.1.00
18- distributed-process-0.6.6
18- distributed-process-0.6.6
19- distributed-process-async-0.2.4
19- distributed-process-async-0.2.4
20- distributed-process-client-server-0.2.3
20- distributed-process-client-server-0.2.3
@@ -43,3 +43,6 @@ extra-package-dbs: []
43
43
44# Allow a newer minor version of GHC than the snapshot specifies
44# Allow a newer minor version of GHC than the snapshot specifies
45# compiler-check: newer-minor
45# compiler-check: newer-minor
46+
47+allow-newer: true
48+