|
@@ -32,13 +32,28 @@ public:
|
|
pthread_mutex_init(&mutex, NULL);
|
|
pthread_mutex_init(&mutex, NULL);
|
|
completed_handshakes = 0;
|
|
completed_handshakes = 0;
|
|
complete_handshake_cbpointer = NULL;
|
|
complete_handshake_cbpointer = NULL;
|
|
|
|
+ if (tot_nodes == 1) {
|
|
|
|
+ // There's no one to handshake with, so we're already done
|
|
|
|
+ pthread_mutex_lock(&mutex);
|
|
|
|
+ void *cbpointer = complete_handshake_cbpointer;
|
|
|
|
+ complete_handshake_cbpointer = NULL;
|
|
|
|
+ pthread_mutex_unlock(&mutex);
|
|
|
|
+ ocall_comms_ready(cbpointer);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void reset(void *cbpointer) {
|
|
void reset(void *cbpointer) {
|
|
pthread_mutex_lock(&mutex);
|
|
pthread_mutex_lock(&mutex);
|
|
completed_handshakes = 0;
|
|
completed_handshakes = 0;
|
|
complete_handshake_cbpointer = cbpointer;
|
|
complete_handshake_cbpointer = cbpointer;
|
|
- pthread_mutex_unlock(&mutex);
|
|
|
|
|
|
+ if (tot_nodes == 1) {
|
|
|
|
+ // There's no one to handshake with, so we're already done
|
|
|
|
+ complete_handshake_cbpointer = NULL;
|
|
|
|
+ pthread_mutex_unlock(&mutex);
|
|
|
|
+ ocall_comms_ready(cbpointer);
|
|
|
|
+ } else {
|
|
|
|
+ pthread_mutex_unlock(&mutex);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void inc() {
|
|
void inc() {
|