| 42 | } |
| 43 | |
| 44 | static void |
| 45 | sendQueries() |
| 46 | { |
| 47 | /* NOTE: DMTCP creates a barrier between |
| 48 | * DMTCP_EVENT_REGISTER_NAME_SERVICE_DATA and DMTCP_EVENT_SEND_QUERIES. |
| 49 | * The calls to send_key_val_pair and send_query require this barrier. |
| 50 | * Associating these functions with the wrong DMTCP events risks aborting |
| 51 | * the computation. Also, calling send_query on a non-existent key |
| 52 | * risks aborting the computation. |
| 53 | * Currently, calling send_query without having previously called |
| 54 | * send_key_val_pair within the same transaction also risks an abort. |
| 55 | */ |
| 56 | |
| 57 | /* Set max size of the buffer &(mystruct.pid) */ |
| 58 | |
| 59 | /* This process was called with an environment variable, |
| 60 | * EXAMPLE_DB_KEY_OTHER, whose value was used to set mystruct_other.key. |
| 61 | */ |
| 62 | uint32_t sizeofPid = sizeof(mystruct_other.pid); |
| 63 | int64_t pidVal; |
| 64 | |
| 65 | dmtcp::kvdb::KVDBResponse response = |
| 66 | dmtcp::kvdb::get64("ex-db", mystruct_other.key, &pidVal); |
| 67 | if (response != dmtcp::kvdb::KVDBResponse::SUCCESS) { |
| 68 | printf("key not found\n"); |
| 69 | abort(); |
| 70 | } |
| 71 | mystruct_other.pid = (pid_t) pidVal; |
| 72 | printf("Data exchanged: My (key,pid) is: (%s, %ld); The other pid is: " |
| 73 | "%ld.\n", mystruct.key, (long)mystruct.pid, (long)mystruct_other.pid); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | static void |
no test coverage detected