Re: Boost::thread cancellation



Venkatraman.S. wrote:
I totally concur, but let me state my problem more clearly :
i have 'a' boss and 'a' worker - the boss receives requests on a
socket and dispatches to the worker thread. If the worker takes more
than 'n' milli seconds then that worker thread needs to be killed. The
way i have presently implemented this is : the boss spawns a new
thread as each request drops in - but as you know, this is again a bad
design. Hence am just thinking about any other possible design ..any
thoughts??

As I said sooner: a queue. Post the requests to a queue and start a couple of workers that proceed the requests.
Either the worker code has to deal with the time-outs itself, or a manager thread has to check for too old workers from time to time. The first case is the most clean solution. The second way requires the workers to check their termination signal from time to time. But the manager removes the timed-out thread immediately from the worker pool and replaces it with a new one to keep the queue responsive.


Marcel
.



Relevant Pages

  • Re: Server.Transfer not working from Application_error for 404 events
    ... for requests of .aspx extensions they ... the worker process whether it exists or not. ... At this point iis is already out of the picture ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: which kind of driver to design for AoE protocol?
    ... You have to process as many requests at raised interrupt level as you ... If you'd queue SRBs to PASSIVE_LEVEL worker in some way just b/c ... about the iSCSI miniport architecture, but would hope it too allows ...
    (microsoft.public.development.device.drivers)
  • how big is the performance hit to map all requests to asp.net worker?
    ... how big is the performance hit to map all requests to asp.net worker ... like file extention .* to be handled by the worker ... considering my app already handles .htm file by the asp.net, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Impossible to work hard and smart
    ... the company structure is different. ... Worker knew turn right no melon, only turn left, but still said, "Yes ... Worker came back after spending 3 hrs in massage parlor, told boss, " ...
    (soc.culture.malaysia)
  • Re: Electrolux Moving to Poland - 500 Jobs Gone
    ... His boss tells him things are tight and gives him about 6 ... Your cousin was obviously a greedy bastard who expected far higher ... This is the dilemma that capitalism brings. ... In the global economy every worker is - just - a worker. ...
    (uk.politics.misc)

Loading