- Subject: Re: [slang-users] Releasing my slang modules/tools/functions
- From: p.boekholt@xxxxxxxxx
- Date: Thu, 9 Sep 2004 09:18:44 +0200
On Tue, Sep 07, 2004 at 03:43:47PM -0400, Jeremy Cowgar wrote:
> Greetings,
>
> go to waste. They include an interface to the socket library,
Hey, it works! However, what happens when the socket is no longer
referenced? In slang.txt it says
Although the preceding example closed the file via fclose, there is no
need to explicitly close a file because S-Lang will automatically
close the file when it is no longer referenced. Since the only
variable to reference the file is fp, it would have automatically been
closed when the function returned.
It seems this is achieved in slstdio.c by storing all streams in the array
SL_File_Table and by the line
cl->cl_destroy = destroy_file_type;
Maybe the SL_File_Table could be used for sockets as well - socket()
returns a file descriptor which can be converted to a stream with fdopen(),
and slstdio.c provides some functions for this: open_file_type() calls
fdopen() and stores the stream in the table and _SLstdio_fdopen() calls
open_file_type() (which is static).
It seems open_file_type creates a FILE_POINTER_TYPE which is an instance
of the "File_Type" class or whatever, so when it's no longer referenced the
file would be closed.
BTW has anyone gotten the mysql module to compile?
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2004 date index]
[2004 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]