Use const keyword for 'int thread_id' variables.

Change-Id: I3afdf8a472cbc4f325b462bc9c42c03bc464f4b2
diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc
index c6b42cf..83e0bd5 100644
--- a/internal/ceres/coordinate_descent_minimizer.cc
+++ b/internal/ceres/coordinate_descent_minimizer.cc
@@ -168,9 +168,9 @@
          j < independent_set_offsets_[i + 1];
          ++j) {
 #ifdef CERES_USE_OPENMP
-      int thread_id = omp_get_thread_num();
+      const int thread_id = omp_get_thread_num();
 #else
-      int thread_id = 0;
+      const int thread_id = 0;
 #endif
 
       ParameterBlock* parameter_block = parameter_blocks_[j];
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc
index 1f594c1..c16e477 100644
--- a/internal/ceres/covariance_impl.cc
+++ b/internal/ceres/covariance_impl.cc
@@ -356,9 +356,9 @@
         int size_i = parameter_sizes[i];
         int size_j = parameter_sizes[j];
 #ifdef CERES_USE_OPENMP
-        int thread_id = omp_get_thread_num();
+        const int thread_id = omp_get_thread_num();
 #else
-        int thread_id = 0;
+        const int thread_id = 0;
 #endif
         double* covariance_block =
             workspace.get() +
@@ -705,9 +705,9 @@
     }
 
 #  ifdef CERES_USE_OPENMP
-    int thread_id = omp_get_thread_num();
+    const int thread_id = omp_get_thread_num();
 #  else
-    int thread_id = 0;
+    const int thread_id = 0;
 #  endif
 
     double* solution = workspace.get() + thread_id * num_cols;
@@ -897,9 +897,9 @@
     }
 
 #  ifdef CERES_USE_OPENMP
-    int thread_id = omp_get_thread_num();
+    const int thread_id = omp_get_thread_num();
 #  else
-    int thread_id = 0;
+    const int thread_id = 0;
 #  endif
 
     double* solution = workspace.get() + thread_id * num_cols;
diff --git a/internal/ceres/program_evaluator.h b/internal/ceres/program_evaluator.h
index 74a812a..597ff18 100644
--- a/internal/ceres/program_evaluator.h
+++ b/internal/ceres/program_evaluator.h
@@ -183,9 +183,9 @@
       }
 
 #ifdef CERES_USE_OPENMP
-      int thread_id = omp_get_thread_num();
+      const int thread_id = omp_get_thread_num();
 #else
-      int thread_id = 0;
+      const int thread_id = 0;
 #endif
       EvaluatePreparer* preparer = &evaluate_preparers_[thread_id];
       EvaluateScratch* scratch = &evaluate_scratch_[thread_id];
diff --git a/internal/ceres/schur_eliminator_impl.h b/internal/ceres/schur_eliminator_impl.h
index 7ee419e..5091b93 100644
--- a/internal/ceres/schur_eliminator_impl.h
+++ b/internal/ceres/schur_eliminator_impl.h
@@ -224,9 +224,9 @@
 #pragma omp parallel for num_threads(num_threads_) schedule(dynamic)
   for (int i = 0; i < chunks_.size(); ++i) {
 #ifdef CERES_USE_OPENMP
-    int thread_id = omp_get_thread_num();
+    const int thread_id = omp_get_thread_num();
 #else
-    int thread_id = 0;
+    const int thread_id = 0;
 #endif
     double* buffer = buffer_.get() + thread_id * buffer_size_;
     const Chunk& chunk = chunks_[i];
@@ -509,9 +509,9 @@
   BufferLayoutType::const_iterator it1 = buffer_layout.begin();
 
 #ifdef CERES_USE_OPENMP
-  int thread_id = omp_get_thread_num();
+  const int thread_id = omp_get_thread_num();
 #else
-  int thread_id = 0;
+  const int thread_id = 0;
 #endif
   double* b1_transpose_inverse_ete =
       chunk_outer_product_buffer_.get() + thread_id * buffer_size_;