2 NSFileHandle bugs?
2 NSFileHandle bugs?
- Subject: 2 NSFileHandle bugs?
- From: Greg Best <email@hidden>
- Date: Mon, 28 Feb 2005 05:03:18 -0800
Hello--
I've run into two NSFileHandle bugs that I want to confirm before
filing a report with Apple. I've searched around the web for
references, and it looks like others have seen these, but the threads
are all left unresolved...
I'm trying to create a SerialPort class to communicate with an embedded
device, but I'm testing with two serial ports and a null modem cable
between them. The serial ports I'm using are Keyspan USB to RS-232
adapters.
The first is that subclasses of NSFileHandle can't use the
initWithFileDescriptor: method. I've seen reference to this being
because NSFileHandle is really a class cluster-- and I assume this
method isn't wired up properly. I've worked around this by building a
GCBSerialPort class that contains a basic NSFileHandle and then mirrors
the methods to the outside so I can subclass it easily when this is
fixed.
The second is that the NSFileHandle doesn't seem to close the device
properly. I've seen comments online that this is because
readInBackgroundAndNotify forks a thread to do the reading and doesn't
terminate properly and release the fd when the NSFH is released. I
think I've just proven that to myself by releasing my GCBSerialPort
(and locking up the device) and then sending data through the cable.
That seems to cause readInBackgroundAndNotify to return with the data
and die-- releasing the device.
I can't find a workaround for this second one that doesn't involve a
lot of working around, and I can't find a way to force that thread to
disengage. It seems to me that this undercuts a lot of the
functionality of the NSFH class...
If anyone can either help me around these or confirm that they're real
so I can report them, I'd be much obliged.
Cheers-
Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden