1
1
/* -*- Mode: C++; c-basic-offset:4; indent-tabs-mode:nil -*- */
2
2
/*
3
- * Copyright (c) 2020-2024 Triad National Security, LLC
3
+ * Copyright (c) 2020-2025 Triad National Security, LLC
4
4
* All rights reserved.
5
5
*
6
6
* Copyright (c) 2020-2021 Lawrence Livermore National Security, LLC
@@ -94,7 +94,7 @@ static void
94
94
zsocket_close (
95
95
void **sock
96
96
) {
97
- if (!sock) return ;
97
+ if (qvi_unlikely ( !sock) ) return ;
98
98
void *isock = *sock;
99
99
if (qvi_likely (isock)) {
100
100
const int rc = zmq_close (isock);
@@ -109,7 +109,7 @@ static void
109
109
zctx_destroy (
110
110
void **ctx
111
111
) {
112
- if (!ctx) return ;
112
+ if (qvi_unlikely ( !ctx) ) return ;
113
113
void *ictx = *ctx;
114
114
if (qvi_likely (ictx)) {
115
115
const int rc = zmq_ctx_destroy (ictx);
@@ -754,14 +754,15 @@ server_rpc_dispatch(
754
754
755
755
qvi_bbuff *res;
756
756
rc = fidfunp->second (server, &hdr, body, &res);
757
- if (rc != QV_SUCCESS && rc != QV_SUCCESS_SHUTDOWN) {
757
+ if (qvi_unlikely ( rc != QV_SUCCESS && rc != QV_SUCCESS_SHUTDOWN) ) {
758
758
cstr_t ers = " RPC dispatch failed" ;
759
759
qvi_log_error (" {} with rc={} ({})" , ers, rc, qv_strerr (rc));
760
760
goto out;
761
761
}
762
762
// Shutdown?
763
- if (rc == QV_SUCCESS_SHUTDOWN) shutdown = true ;
764
-
763
+ if (qvi_unlikely (rc == QV_SUCCESS_SHUTDOWN)) {
764
+ shutdown = true ;
765
+ }
765
766
rc = zmsg_init_from_bbuff (res, msg_out);
766
767
out:
767
768
zmq_msg_close (msg_in);
@@ -795,7 +796,7 @@ server_go(
795
796
rc = zmsg_send (zworksock, &mtx, &bsent);
796
797
if (qvi_unlikely (rc != QV_SUCCESS)) break ;
797
798
bsentt += bsent;
798
- } while (active);
799
+ } while (qvi_likely ( active) );
799
800
#if QVI_DEBUG_MODE == 1
800
801
// Nice to understand messaging characteristics.
801
802
qvi_log_debug (" Server Sent {} bytes" , bsentt);
@@ -885,18 +886,18 @@ qvi_rmi_server_start(
885
886
) {
886
887
// First populate the base hardware resource pool.
887
888
int qvrc = server_populate_base_hwpool (server);
888
- if (qvrc != QV_SUCCESS) return qvrc;
889
+ if (qvi_unlikely ( qvrc != QV_SUCCESS) ) return qvrc;
889
890
890
891
server->zlo = zsocket_create_and_connect (
891
892
server->zctx , ZMQ_REQ, server->config .url .c_str ()
892
893
);
893
- if (!server->zlo ) return QV_ERR_RPC;
894
+ if (qvi_unlikely ( !server->zlo ) ) return QV_ERR_RPC;
894
895
895
- int rc = pthread_create (
896
+ const int rc = pthread_create (
896
897
&server->worker_thread , nullptr ,
897
898
server_start_threads, server
898
899
);
899
- if (rc != 0 ) {
900
+ if (qvi_unlikely ( rc != 0 ) ) {
900
901
cstr_t ers = " pthread_create() failed" ;
901
902
qvi_log_error (" {} with rc={} ({})" , ers, rc, qvi_strerr (rc));
902
903
qvrc = QV_ERR_SYS;
0 commit comments