You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variable in synchronized hashtable seems not thread-safe #13
I have a variable: $syncHash.count, which is supposed to be thread-safe. But in this case, it's not:
$collection | Invoke-Parallel -scriptblock {
$syncHash.count ++
}
I have to use mutex to protect it, in order to get correct count:
$collection | Invoke-Parallel -scriptblock {
$syncHash.mutex.WaitOne()
$syncHash.count ++
$syncHash.mutex.ReleaseMutex()
}
Activity