[Gambas-devel] gb.net updated
Benoit Minisini
gambas at ...1...
Tue Dec 13 14:14:58 CET 2005
On Tuesday 13 December 2005 13:50, Daniel Campos wrote:
> > But you already inherited it from the Stream class. You don't have to
> > overwrite it; you have to return it from the "handle" function of the
> > stream
> > implementation.
> >
> > For example, in the Socket class implementation, you just have to return
> > it
> > from your CSocket_stream_handle() function instead of always returning
> > zero.
>
> Do you think there will be no problems with your internal gbx code to
> manage streams if I return a value different from Zero? I think I removed
> that due to any problem with any of your interpreter functions that checks
> the value of the stream handle...
>
> Regards,
>
> D. Campos
>
The interpreter uses the stream handle returned by this function in the
following cases:
1) When closing a stream, if the stream handle is >= 0, then GB.Watch() is
called to stop watching this file descriptor if it is watched. Then the
stream close function is called.
2) When using LOCK or UNLOCK, the stream handle is used.
3) When calling Lof(), if the stream lof function returns a zero length, then
the stream handle is used to call ioctl(..., FIONREAD, ...) to know how many
bytes are readable on the handle.
4) To implement the Stream.Handle / Stream.Id property.
That's all (I think so) :-)
Note that you chose to return 0, that is a perfectly valid file handle. If you
don't want to return any file handle, you have to return (-1), or to pass a
NULL as stream handle function pointer.
Regards,
--
Benoit Minisini
More information about the Devel
mailing list