pcp
[Top] [All Lists]

Global Timeout for Service Discovery

To: PCP Mailing List <pcp@xxxxxxxxxxx>
Subject: Global Timeout for Service Discovery
From: Dave Brolley <brolley@xxxxxxxxxx>
Date: Tue, 22 Jul 2014 15:22:03 -0400
Delivered-to: pcp@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
The following commit implements a global timeout for __pmDiscoverServicesWithOptions().

The timeout is specified as "timeout=N.N" in the global options string argument, where N.N is a floating point value indicating the number of seconds before timing out.

The implementation is a sleeping thread which wakes up after the specified amount of time and sets a flag indicating that the timeout has expired. If the discovery process finishes before the timeout, the sleeping thread is cancelled. The flag exists on the stack of __pmDiscoverServicesWithOptions() which joins with the sleeping thread before returning, thus ensuring that it is always safe for the sleeping thread to set the flag.

The implementation is reflected in pmfind(1) vie the new --timeout=N.N and -t N.N options.

The implementation also creates a new __pmServiceDiscoveryOptions struct which gets passed among the internal functions where the 'flags' argument of __pmDiscoverServicesWithOptions() was previously passed. It also consolidates some duplication among various internal options structures.

As usual, it's on the brolley/dev branch of pcpfans.

Dave
----------------------------------------------------
commit 567fadf6b8c59f86467f3a68c70ad7612bb7c3ce
Author: Dave Brolley <brolley@xxxxxxxxxx>
Date:   Tue Jul 22 14:41:25 2014 -0400

    Implement a global timeout option for service discovery.

    timeout=N.N in the options string will interrupt service
    discovery if it has not completed within the specified
    number of seconds.

<Prev in Thread] Current Thread [Next in Thread>