Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / sgen / sgen-protocol.c
index 66e80d97e55483c544d38ed56214085926010149..b53965b4aebe1e503d32a8e3444a4f28a79f495b 100644 (file)
@@ -1,6 +1,6 @@
-/*
- * sgen-protocol.c: Binary protocol of internal activity, to aid
- * debugging.
+/**
+ * \file
+ * Binary protocol of internal activity, to aid debugging.
  *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
@@ -16,7 +16,7 @@
 #include "sgen-gc.h"
 #include "sgen-protocol.h"
 #include "sgen-memory-governor.h"
-#include "sgen-thread-pool.h"
+#include "sgen-workers.h"
 #include "sgen-client.h"
 #include "mono/utils/mono-membar.h"
 #include "mono/utils/mono-proclib.h"
@@ -365,11 +365,15 @@ protocol_entry (unsigned char type, gpointer data, int size)
        buffer->buffer [index++] = type;
        /* We should never change the header format */
        if (include_worker_index) {
+               int worker_index;
+               MonoNativeThreadId tid = mono_native_thread_id_get ();
                /*
                 * If the thread is not a worker thread we insert 0, which is interpreted
                 * as gc thread. Worker indexes are 1 based.
                 */
-               buffer->buffer [index++] = (unsigned char) sgen_thread_pool_is_thread_pool_thread (mono_native_thread_id_get ());
+               worker_index = sgen_thread_pool_is_thread_pool_thread (tid);
+               /* FIXME Consider using different index bases for different thread pools */
+               buffer->buffer [index++] = (unsigned char) worker_index;
        }
        memcpy (buffer->buffer + index, data, size);
        index += size;