You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a client passes a non-nil OutputFile *os.File to the Pigosat constructor, the constructor opens a *C.FILE and leaves it open, passing it to Picosat. Since we create the *C.FILE in the constructor, we should close it in the destructor. This may require holding onto the *C.FILE in the Pigosat object (in a private data member), to be closed in Pigosat.delete. Make sure to set this data member to nil when delete is done with it.
We should test that closing the *C.FILE does not close the underlying *os.File. From what I can tell from the manpage for fclose, fclose(*FILE) only dissociates the particular instance of *FILE from the underlying file descriptor, so closing one *FILE doesn't close the descriptor for other open instances of that descriptor.
The text was updated successfully, but these errors were encountered:
Turns out calling c.fclose(outputFile) actually does close the underlying file descriptor. The up shot is that we cannot close the *C.FILE reference to OutputFile without closing the underlying file. It's better for the client to do this.
If a client passes a non-nil
OutputFile *os.File
to the Pigosat constructor, the constructor opens a*C.FILE
and leaves it open, passing it to Picosat. Since we create the*C.FILE
in the constructor, we should close it in the destructor. This may require holding onto the*C.FILE
in thePigosat
object (in a private data member), to be closed inPigosat.delete
. Make sure to set this data member to nil whendelete
is done with it.We should test that closing the
*C.FILE
does not close the underlying*os.File
. From what I can tell from the manpage forfclose
,fclose(*FILE)
only dissociates the particular instance of*FILE
from the underlying file descriptor, so closing one*FILE
doesn't close the descriptor for other open instances of that descriptor.The text was updated successfully, but these errors were encountered: