[ipopt_internal] Fix thread-safety of global variable

https://github.com/coin-or/Ipopt/pull/857

--- src/Algorithm/IpIpoptAlg.cpp
+++ src/Algorithm/IpIpoptAlg.cpp
@@ -4,6 +4,8 @@
 //
 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
 
+#include <atomic>
+
 #include "IpoptConfig.h"
 #include "IpIpoptAlg.hpp"
 #include "IpJournalist.hpp"
@@ -116,7 +118,7 @@
       "The overall algorithm time is unaffected by this option.");
 }
 
-static bool copyright_message_printed = false;
+static std::atomic_bool copyright_message_printed{false};
 
 bool IpoptAlgorithm::InitializeImpl(
    const OptionsList& options,

--- src/Common/IpUtils.cpp
+++ src/Common/IpUtils.cpp
@@ -7,6 +7,7 @@
 #include "IpoptConfig.h"
 #include "IpUtils.hpp"
 
+#include <atomic>
 #include <cstdlib>
 #include <cmath>
 #include <cfloat>
@@ -139,7 +140,7 @@
 #endif
 }
 
-static double Wallclock_firstCall_ = -1.;
+static std::atomic<double> Wallclock_firstCall_{-1.0};
 
 // The following function were taken from CoinTime.hpp in COIN/Coin
 Number CpuTime()
@@ -182,10 +183,8 @@
 Number WallclockTime()
 {
    double callTime = IpCoinGetTimeOfDay();
-   if( Wallclock_firstCall_ == -1. )
-   {
-      Wallclock_firstCall_ = callTime;
-   }
+   double first_call_sentinel = -1.0;
+   Wallclock_firstCall_.compare_exchange_strong(first_call_sentinel, callTime, std::memory_order_seq_cst, std::memory_order_seq_cst);
    return callTime - Wallclock_firstCall_;
 }
 
