+/* Callback for iterate over threads. Used to check whether
+ the current inferior is multi-threaded. Returns true as soon
+ as it sees the second thread of the current inferior. */
+
+static int
+inf_has_multiple_thread_cb (struct thread_info *tp, void *data)
+{
+ int *count_p = (int *) data;
+
+ if (current_inferior ()->pid == ptid_get_pid (tp->ptid))
+ (*count_p)++;
+
+ /* Stop the iteration if multiple threads have been detected. */
+ return *count_p > 1;
+}
+
+/* Return true if the current inferior is multi-threaded. */
+
+static int
+inf_has_multiple_threads (void)
+{
+ int count = 0;
+
+ iterate_over_threads (inf_has_multiple_thread_cb, &count);
+ return (count > 1);
+}
+