示例#1
0
/* generic uint32 parser */
static char *bta_hf_client_parse_uint32(char *buffer, void (*handler_callback)(UINT32))
{
    UINT32 value;
    int res;
    int offset;

    res = sscanf(buffer, "%u%n", &value, &offset);
    if (res < 1) {
        return NULL;
    }

    buffer += offset;

    AT_CHECK_RN(buffer);

    handler_callback(value);
    return buffer;
}
示例#2
0
static void *handler_sys_syn(void *arg)
{
    //printf("signal thread %ld\n", syscall(__NR_gettid));
    module_log_error(MODULE_LOG_DEBUG, test_log, 0, "signal thread %ld start...\n", syscall(__NR_gettid));
    int ret;
    int sig;
    sigset_t *set = arg;

    while (1)
    {
        ret = sigwait(set, &sig);
        if (!ret)
        {
            handler_callback(sig);
        }
        else
        {
            printf("sigwait: %s\n", strerror(errno));
        }
    }

    return NULL;
}