----boundary-LibPST-iamunique-2127991775_-_-
Content-type: text/plain
Dear Andrew, dear Mark,
long time ago I had a close statement inside my subsystem Dos (DosDiffDir.DiffBin) active.
I get the following problem while the Close statement was active:
- I had open file x interactively and have done some changes (not saved yet)
- I run DosDiffDir which opened and closed file x
- I work further with file x interactively
- Suddenly I get trap and all changes was lost
- It was also not able to save the changes of file x after DosDiffDir was running.
So I can't recommend to use the command close until you are sure that there is no other use of the same file.
Regards
Helmut Zinn
-----Ursprüngliche Nachricht-----
Von: blackbox{([at]})nowhere.xy
microsystems AG, Tech-Support
Gesendet: Dienstag, 17. Januar 2006 11:38
An: BlackBox Mailing List
Betreff: [BlackBox] - closing shared files
Andrew,
> However looking at module HostFiles I am not sure that Close
> does "nothing" for files opened in shared mode.
You are right. The corrected sentence reads as follows: "Close does
nothing if the file is not open."
> I suspect that statements like
> IF Files.dir.Old(....files.shared) # NIL THEN ... END
> are causing problems. Maybe FINALIZE does not get called in this case?
No problem with this. The documentation says: "If a call to New or Old
is not balanced by a call to Close, the Close is later performed
automatically, at an unspecified time." Close will not be called until
the garbage collector kicks in and calls FINALIZE on the anonymous file
object created by the statement above.
> Do I have to explicitly close the file f by calling f.Close?
In your case this would probably be the right thing to do unless it is
okay to wait that unspecified amount of time for the garbage collector.
with best regards
Marc
Oberon microsystems AG
+41 (0)44 445 17 51
www.oberon.ch
>
>
> -----Original Message-----
> From: blackbox{([at]})nowhere.xy> Behalf Of A Thomas
> Sent: Donnerstag, 12. Januar 2006 09:16
> To: Blackbox
> Subject: [BlackBox] - closing shared files
>
>
> Hei BlackBox community,
>
> I am very confused about the need to close files
> that have been opened in shared mode. Suppose I open a file
> in shared mode using f := Files.dir.Old(... Files.shared) and
> read the file and find some sort of error in its contents
> that requires the file to be edited. So long as the file f is
> not stored in a global variable I think there should be no
> problem, I should be able to start say NotePad to edit the
> file. Do I have to explicitly close the file f by calling
> f.Close? In the documentation for module File it says
>
> PROCEDURE (f: File) Close
> NEW, ABSTRACT
> Closes an open file. Close does nothing if the file is not
> open or if it has been opened in "shared" mode. If a call to
> New or Old is not balanced by a call to Close, the Close is
> later performed automatically, at an unspecified time. If it
> is known that a file won't be used again, it is recommended
> to call its Close procedure. The file f and the riders
> operating on file f are not valid anymore after closing f,
> i.e., no more file or rider operations may be performed on
> it. However, the closed file can be retrieved and opened
> again by procedure Old. Close may call Flush internally.
> Close should (but need not necessarily) be called explicitly
> after a file is not needed anymore.
>
> However looking at module HostFiles I am not sure that Close
> does "nothing" for files opened in shared mode.
>
>
> I suspect that statements like
>
> IF Files.dir.Old(....files.shared) # NIL THEN ... END
>
> are causing problems. Maybe FINALIZE does not get called in this case?
>
> Moi
>
> Andrew
>
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
---------------
Diese E-Mail wurde auf Viren ueberprueft.
IG Metall
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-2127991775_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBEZWFyIEFuZHJldywgZGVhciBN
YXJrLFxwYXINClxwYXINCmxvbmcgdGltZSBhZ28gSSBoYWQgYSBjbG9zZSBzdGF0ZW1lbnQgaW5z
aWRlIG15IHN1YnN5c3RlbSBEb3MgK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