Fix nested spin locks in thread pool etw firing (#17677)
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Fri, 20 Apr 2018 02:47:52 +0000 (19:47 -0700)
committerGitHub <noreply@github.com>
Fri, 20 Apr 2018 02:47:52 +0000 (19:47 -0700)
commit83fbfec318a64d85012ffaed86e4086d8a199098
treece32630086569c8147fc64ac2a377c55d8500ccb
parentb907403ea3d00ac56d2deaeef203adef289c4098
Fix nested spin locks in thread pool etw firing (#17677)

`UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here:

```
SpinLock::GetLock + 0x8E (0x719da71d)
EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e)
EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a)
EventPipe::WriteEventInternal + 0x125 (0x71951c93)
EventPipe::WriteEvent + 0x91 (0x71951714)
EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6)
FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b)
UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597)
```

Nesting spin locks is not allowed, moved the ETW firing outside the lock.
src/vm/threadpoolrequest.cpp