* [Q]: pthreads - How do you enforce a timeout?
@ 1995-04-19 4:00 Matthias Winkler
0 siblings, 0 replies; only message in thread
From: Matthias Winkler @ 1995-04-19 4:00 UTC (permalink / raw)
Hi,
I wrote a function foo() that I want to terminate primaturely
in case it does not return within a given period of time. I
thought I could kick off a pthread for foo() which is a bit of
a hassle since I have to pass the params of foo() as
pthread_addr_t, however this is not the real problem. After a
certain amount of time has elapsed I call pthread_cancel() to
terminate foo().
With this solution I have to adapt foo() - it now has to accept
exactly one parameter of pthread_addr_t. What I would like was
to find a way to define macros so I could write:
BEGIN_MONITOR_TIMEOUT(seconds)
{
foo(param1, param2, param3, param4);
} END_MONITOR_TIMEOUT;
Does somebody have a clue on how this could be implemented?
Am I right in the assumption that one can not simply use
exceptions to terminate a thread since you can not raise an
exception to a specific thread in a straightforward manner.
Thank you,
Matthias
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1995-04-19 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-04-19 4:00 [Q]: pthreads - How do you enforce a timeout? Matthias Winkler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox