Integrating Win32 changes

Jeff Sturm jsturm@sigma6.com
Sat Apr 1 00:00:00 GMT 2000


Per Bothner wrote:
> > Yuck. Then we need extra code to allocate unique fd's, make it
> > thread-safe, etc. I'd prefer to just cast HFILE to/from int, which is a
> > safe thing to do on any Win32 platform currently in use.
>> I think you misunderstand. If the "handle" you want to use is an int,
> just use that. If the "handle" is a pointer, then using an int field
> is bad. That is what the RawData feature is for. I don't see anything
> that would require us to allocate unique fd's or whatever.

I first thought you meant to create a mapping from fd to handle. You
mean have both:
int fd;
RawData handle;
then ignore `handle' for POSIX targets, and ignore `fd' for Win32
targets? I suppose you could do that, but why? Win32 file "handles"
are _not_ pointers. They are opaque 32-bit values, similar to POSIX
file descriptors.
> For example, I think it would make sense to implement a
> natFileDescriptorStdio.cc. That would be more portable
> than natFileDescriptorPosix.cc (though less efficient).
> natFileDescriptorStdio would need to store the (FILE*) in a
> RawData handle rather than an int fd.

Yes, in that case RawData makes sense.
-- 
Jeff Sturm
jsturm@sigma6.com


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /