* Update `Lock` object speclet

* Remove async relaxation
This commit is contained in:
Jan Jones 2024-03-13 10:13:30 +01:00 коммит произвёл GitHub
Родитель 8e45941e0a
Коммит 2f6b4726ee
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -86,6 +86,16 @@ lock (l) { } // monitor-based locking is used here
```
Note that this warning occurs even for equivalent explicit conversions.
The compiler avoids reporting the warning in some cases when the instance cannot be locked after converting to `object`:
- when the conversion is implicit and part of an object equality operator invocation.
```cs
var l = new System.Threading.Lock();
if (l != null) // no warning even though `l` is implicitly converted to `object` for `operator!=(object, object)`
// ...
```
To escape out of the warning and force use of monitor-based locking, one can use
- the usual warning suppression means (`#pragma warning disable`),
- `Monitor` APIs directly,