I usually heard that it is a good idea to unlock locks before calling event listeners to avoid a dead end. However, since the block lock {}is reentrant over the same thread in C #, is it okay to trigger events from a blocked block, or do I need to make a copy of the corresponding status data and trigger an event outside the block block?
lock {}
If not, provide an example when it would be a problem to trigger an event from a block lock {}.
thank
, lock. , .
lock
, , . , - , , . . (.. Join()) . , , lock, bingo. .
Join()
, , lock, "" . lock, .
, , , , - (, ), , ( , ). , .
, , , . , . , . , ! -, ( , ).
, . - , , .
In general, you want to minimize the time that you are in the lock, to prevent blocking for too long (causing delays), and also to reduce the likelihood that you will have code that could fail during the lock.
Source: https://habr.com/ru/post/1776221/More articles:GDI leak problem - cIs it possible to force jQuery.jScrollPane to show a vertical scrollbar? - javascriptLocalized Views Using Razor - asp.net-mvcC # need to raise an event when in the LOCK area - c #android.database.sqlite.SQLiteConstraintException - androidOne shipping fee to paypal online store - paypalAbstract object cannot declare - c ++Erlang and websockets - erlangMVC: client validation fails, but data is still being sent - asp.net-mvc-2How to get the current full url (url + fragments) of a web page in php., - phpAll Articles