* Clean rundown of RPC connection?
@ 1994-10-27 18:39 Brad Daniels
0 siblings, 0 replies; only message in thread
From: Brad Daniels @ 1994-10-27 18:39 UTC (permalink / raw)
We have a program which monitors a small homebrew database for changes and
returns change records to clients. When each client connects, we create
a change queue for the connection and associate it with a context handle.
When the client program then requests data, the server checks the connection's
queue. If the queue is empty, the request thread goes into a timed wait on
a condition variable associated with the queue. The thread which monitors
the database then puts changes in the queue as they occur and signals the
condition variable (whose associated predicate checks if the queue is
empty.) We use the cond_timedwait to avoid excessive overhead when no
changes are happening in the database.
All of the above works fine until we kill off the client while it is waiting
for changes. We need to let any queue manipulations finish and unlock all
mutexes before performing rundown to destroy the queue. We tried using
pthread_setasynccancel to prevent the thread from exiting before we finish,
but that does not seem to have any effect. In fact, the behavior we are
seeing is quite puzzling. If we print the thread ID of the thread servicing
the request for changes, the number is the same as the one we get when we
print the thread ID in the rundown routine. We have no idea how the thread is
getting out of our request routine and into the rundown routine. We have
considered using pthread_cleanup_push, but we use C++ functions which we
cannot clean up safely. We need to ensure that certain operations complete
before rundown. Is there anything we can do? What mexchanism is used
to stop the processing of the request?
Any info is much appreciated.
Thanks,
- Brad
-------------------------------------------------------------------
+ Brad Daniels | "Oh, I know you did... +
+ Biles and Associates | but let's pretend you didn't." +
+ These are my views, not B&A's | - Darkman +
-------------------------------------------------------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1994-10-27 18:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-27 18:39 Clean rundown of RPC connection? Brad Daniels
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox