Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
831045a7
Commit
831045a7
authored
28 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-03-14 05:16:26 by sof]
FILE finaliser
parent
4720b45e
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/lib/cbits/freeFile.lc
+52
-0
52 additions, 0 deletions
ghc/lib/cbits/freeFile.lc
with
52 additions
and
0 deletions
ghc/lib/cbits/freeFile.lc
0 → 100644
+
52
−
0
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}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment