A Dilemma about synchronous blocking and SSL
A Dilemma about synchronous blocking and SSL
- Subject: A Dilemma about synchronous blocking and SSL
- From: Larry Gerndt <email@hidden>
- Date: Tue, 15 Jul 2003 23:44:46 -0700
I have a dilemma to solve which I could use a little advice on:
I use two MP Tasks, one for reading a socket, the other for writing to it.
The socket is configured for blocking reads and writes. Apparently the
socket has no problems with these two threads being preemptive, you can
write and read from preemptive tasks on a single socket. However, according
to Doug Mitchell from Apple, SSL does not work that way. He says that
SSLWrite and SSLRead on a single shared context are not thread safe between
two preemptive tasks. This means I have to make a "critical region" (a
mutually exclusive region made via the MP API) around the calls to SSLWrite
and SSLRead. But this poses a problem: Once I enter the critical region to
do a read, it blocks until data actually arrives, which may be a long time
if ever. Meanwhile, since it's in the critical region, no writes can occur.
The only solution I can think of to solve this dilemma is to make the socket
non-blocking. Am I correct? I hate to do this because synchronous blocking
is so much cleaner, code wise, and my existing code makes use of it a lot.
But I got away with it because sockets apparently do not impose this
restriction.
--
Larry Gerndt
AIM Handle: SonOfTheSonOfMan
Let the truth be told though the heavens fall -- James Garrison
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.