Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
831045a7
Commit
831045a7
authored
Mar 14, 1997
by
sof
Browse files
[project @ 1997-03-14 05:16:26 by sof]
FILE finaliser
parent
4720b45e
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/lib/cbits/freeFile.lc
0 → 100644
View file @
831045a7
%
% (c) The GRASP/AQUA Project, Glasgow University, 1997
%
\subsection[freeFile.lc]{Giving up files}
\begin{code}
#include "rtsdefs.h"
#include "stgio.h"
/* sigh, the standard channels are handled differently,
we don't want them freed via the ForeignObj finaliser,
as we probably want to use these channels before we
*really* shutdown (dumping stats etc.)
*/
void freeStdChannel(fp)
StgForeignObj fp;
{ return; }
void freeFile(fp)
StgForeignObj fp;
{
int rc;
if ( fp == NULL || (rc = unlockFile(fileno((FILE *)fp))) ) {
/* If the file handle has been explicitly closed
* (via closeFile()) or freed, we will have given
* up our process lock, so we silently return here.
*/
return;
}
/*
* The finaliser for the FILEs embedded in Handles. The RTS
* assumes that the finaliser runs without problems, so all
* we can do here is fclose(), and hope nothing went wrong.
*
* Assume fclose() flushes output stream.
*/
rc = fclose((FILE *)fp);
/* Error or no error, we don't care.. */
/*
if ( rc == EOF ) {
fprintf(stderr. "Warning: file close ran into trouble\n");
}
*/
return;
}
\end{code}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment