freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] select, pselect and signals...
- Date: Wed, 22 Sep 2010 17:05:06 +0200
Hi,
we have still to release a new version but I have already patches for
next... One of the biggest one is MARS support. One of the problems with
MARS is threading and canceling. Supposing that two threads works on a
single connection using two different statements (which is possible with
MARS!) one thread should be able to acquire a network lock and send/receive
its packet while the other have to wait. Well... this seems easy but
considering that
- the thread with network lock could receive a packet for another session
and should post the packet to the other thread (or let the other thread read
its packet)
- cancellation could occur in another (third) thread or even in the same
thread (using signals like alarm)!
Well.. the code is quite good but one of the problems it's finding a way to
portably signal the network thread to stop waiting and consider a new
condition. This is possible for instance if the network thread is waiting
for a thread but another thread wants to send a packet. In this case a poll
is waiting for data (not for sending) but have to stop in order to wait
data/sending. The solution I found is creating a socket-pair and use this
pair to signal poll to stop. Using signal is not a suitable way cause
pselect/ppoll is not portable. However this require 3 file descriptors (1
for server socket and 2 for socket-pair).
Any advise is accepted.
bye
freddy77
- [freetds] select, pselect and signals..., Frediano Ziglio, 09/22/2010
Archive powered by MHonArc 2.6.24.