waitForDataInBackgroundAndNotify blocking
waitForDataInBackgroundAndNotify blocking
- Subject: waitForDataInBackgroundAndNotify blocking
- From: Yann Bizeul <email@hidden>
- Date: Wed, 12 Jan 2005 16:52:51 +0100
Hi list !
What I'm trying to do :
Implementing dialing of a phone number using the internal modem.
Do it asynchronously (non blocking).
Somewhat kepp the modem open for quickest subsequent dialing.
How I'm trying to do it:
The prerequisite for a non blocking operation means I'll have to
thread this operation.
My class has a static variable to store the read NSFileHandle opened
to the modem device (/dev/cu.modem). That means that if this var is not
assigned, I have to prepare the read NSFileHandle, this operation does
block the thread because of the time needed for the kernel to load the
modem module.
After this, I call waitForDataInBackgroundAndNotify on the file handle
to get modem responses to my commands.
What happen :
The first time I dial out, all works fine, the static variable is
assigned, I get modem responses without problems. Great.
Subsequent calls to dialing seem to block on
waitForDataInBackgroundAndNotify, the thread just hangs and I'm then
unable to dial out again using the modem.
Clues :
Can this be related to thread safety of NSFileHandle ? I don't know if
there is some points to take care when using them in threads.
Can this be related to the fact I keep open a NSFileHandle to read the
output, but using a new one to write on it each time ?
Do I need to do something special on the NSFileHandle at the end of
the first try ? I just un-register for the notification (since there
will be no longer an object to receive them)
--
Yann Bizeul - yann at tynsoe.org
Please use this e-mail when writing to me.
You can visit my projects at this address :
http://projects.tynsoe.org/
(BuddyPop - GeekTool - SSH Tunnel Manager...)
_______________________________________________
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