Created
July 12, 2012 06:40
-
-
Save master-q/3096308 to your computer and use it in GitHub Desktop.
HaskellのflushStdHandles関数のコールグラフ (間違い?)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flushStdHandles | |
-> hFlush stdout | |
-> wantWritableHandle "hFlush" stdout flushWriteBuffer | |
let (FileHandle _ m) = stdout -- mはMVar | |
-> wantWritableHandle' "hFlush" stdout m flushWriteBuffer | |
let act = checkWritableHandle flushWriteBuffer | |
-> withHandle_' "hFlush" stdout m act | |
let act' = \h_ -> {do a <- act h_; return (h_,a)} | |
-> withHandle' "hFlush" stdout m act' | |
-> (h',v) <- do_operation "hFlush" h act' m | |
h_ <- takeMVar m | |
-> checkHandleInvariants h_ | |
-> act' h_ | |
-> checkWritableHandle | |
-> flushWriteBuffer | |
-> flushByteWriteBuffer | |
bbuf <- readIORef haByteBuffer | |
-> bbuf' <- Buffered.flushWriteBuffer haDevice bbuf | |
-> writeBuf' haDevice buf | |
-> writeBuf haDevice buf | |
let bytes = bufferElems bbuf | |
let f = \ptr -> IODevice.write haDevice (ptr `plusPtr` bufL bbuf) bytes | |
withBuffer bbuf f | |
return bbuf{ bufL=0, bufR=0 } | |
writeIORef haByteBuffer bbuf' | |
-> checkHandleInvariants h' | |
putMVar m h' | |
return v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment