[Mono-dev] Fixes related to the profiler writer thread

Massimiliano Mantione massi at ximian.com
Fri Apr 10 07:03:02 EDT 2009


I am running the runtime tests under the logging profiler (with various

One problem I noticed is that the runtime sometimes waits for the
profiler writer thread, even if its manage callback returns false.
This makes so that some of the tests never terminates.

Another problem related to the profiler writer thread is that to detect
when it must detach from the runtime (and never access runtime data
structures again) it uses the thread manage callback.
The problem is, this callback is called as soon as the main thread
terminates, and in this way the profiler does not profile any thread
that continues its execution.
For this Rodrigo coded a patch in the past, that added one more callback
to MonoThread, but it has never been applied (it was not ok in that

The attached patch is an attempt to solve the two problems.
It does not add generic mechanisms and is totally profiler-specific.
However, for the profiler's needs it's OK.

In the end the profiler needs two things:
- that its thread is left running (like the finalizer), and
- to know when its small_id is going to disappear (because the
statistical profiler cannot work without it).
So in the patch I do exactly these two things.

Is it acceptable or should we solve this problem in a different way?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: profiler-thread-callbacks.diff
Type: text/x-patch
Size: 3324 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090410/c88daaa7/attachment.bin 

More information about the Mono-devel-list mailing list