Created
December 22, 2017 13:34
-
-
Save Criteo-dotnet-blog/173f517c0e5c28629bb4fc760f5654e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private ThreadPoolItem GetQueueUserWorkItemCallback(dynamic element) | |
| { | |
| ThreadPoolItem tpi = new ThreadPoolItem() | |
| { | |
| Address = (ulong)element, | |
| Type = ThreadRoot.WorkItem | |
| }; | |
| // look for the callback given to ThreadPool.QueueUserWorkItem() | |
| var callback = element.callback; | |
| if (callback == null) | |
| { | |
| tpi.MethodName = "[no callback]"; | |
| return tpi; | |
| } | |
| var target = callback._target; | |
| if (target == null) | |
| { | |
| tpi.MethodName = "[no callback target]"; | |
| return tpi; | |
| } | |
| ClrType targetType = target.GetClrType(); | |
| if (targetType == null) | |
| { | |
| tpi.MethodName = $" [target=0x{(ulong)target}]"; | |
| } | |
| else | |
| { | |
| // look for method name | |
| tpi.MethodName = BuildDelegateMethodName(targetType, callback); | |
| } | |
| return tpi; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment