persist_wait.c 869 Bytes
Newer Older
1
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2
/*
Pavan Balaji's avatar
Pavan Balaji committed
3
 *  (C) 2009 by Argonne National Laboratory.
4
5
6
 *      See COPYRIGHT in top-level directory.
 */

Pavan Balaji's avatar
Pavan Balaji committed
7
#include "hydra.h"
8
9
10
11
12
13
14
15
16
17
18
#include "bsci.h"
#include "persist_client.h"

HYD_status HYDT_bscd_persist_wait_for_completion(int timeout)
{
    int ret, i, all_done;
    HYD_status status = HYD_SUCCESS;

    HYDU_FUNC_ENTER();

    while (1) {
19
        status = HYDT_dmx_wait_for_event(timeout);
20
21
22
23
        HYDU_ERR_POP(status, "error waiting for event\n");

        all_done = 1;
        for (i = 0; i < HYDT_bscd_persist_node_count; i++) {
Pavan Balaji's avatar
Pavan Balaji committed
24
            ret = HYDT_dmx_query_fd_registration(HYDT_bscd_persist_control_fd[i]);
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
            if (ret)
                all_done = 0;
        }

        if (all_done)
            break;
    }

  fn_exit:
    HYDU_FUNC_EXIT();
    return status;

  fn_fail:
    goto fn_exit;
}