libnetutils/dhcp_utils.c
static int wait_for_property(const char *name, const char *desired_value, int maxwait)
{
    char value[PROPERTY_VALUE_MAX] = {'\0'};
    int maxnaps = maxwait / NAP_TIME;

    if (maxnaps < 1) {
        maxnaps = 1;
    }

    while (maxnaps-- > 0) {
        usleep(1000000);
        if (property_get(name, value, NULL)) {
            if (desired_value == NULL || 
                    strcmp(value, desired_value) == 0) {
                return 0;
            }
        }
    }
    return -1; /* failure */
}
/*
 * Wait for a system property to be assigned a specified value.
 * If desired_value is NULL, then just wait for the property to
 * be created with any value. maxwait is the maximum amount of
 * time in seconds to wait before giving up.
 */
Wait for a system property to be assigned a specified value.
If desired_value is NULL, then just wait for the property to
be created with any value. maxwait is the maximum amount of
time in seconds to wait before giving up.
Wait for a system property to be assigned a specified value . If desired_value is NULL then just wait for the property to be created with any value . maxwait is the maximum amount of time in seconds to wait before giving up .
static int wait_for_property(const char *name, const char *desired_value, int maxwait)
{
    char value[PROPERTY_VALUE_MAX] = {'\0'};
    int maxnaps = maxwait / NAP_TIME;
    if (maxnaps < 1) {
        maxnaps = 1;
    }
    while (maxnaps-- > 0) {
        usleep(1000000);
        if (property_get(name, value, NULL)) {
            if (desired_value == NULL || 
                    strcmp(value, desired_value) == 0) {
                return 0;
            }
        }
    }
    return -1; 
}
static int wait_for_property ( const char * name , const char * desired_value , int maxwait ) { char value [ PROPERTY_VALUE_MAX ] = { ' \0 ' } ; int maxnaps = maxwait / NAP_TIME ; if ( maxnaps < 1 ) { maxnaps = 1 ; } while ( maxnaps -- > 0 ) { usleep ( 1000000 ) ; if ( property_get ( name , value , NULL ) ) { if ( desired_value == NULL || strcmp ( value , desired_value ) == 0 ) { return 0 ; } } } return -1 ; }
Wait for a system property to be assigned a specified value.
Wait for a system property to be assigned a specified value .
/* failure */