Difference between revisions of "Coding Conventions"
From Agility
(→Critical sections should be small and predictable) |
(→Multithreading) |
||
| Line 4: | Line 4: | ||
==Multithreading== | ==Multithreading== | ||
| − | + | ===Critical sections should be small=== | |
| + | |||
| + | To avoid dead-locks critical sections should be small enough to prove that dead lock is not possible. | ||
| + | Critical section should not cover any complicated business task which access database (for example business action). | ||
| + | |||
| + | Please AVOID below construction: | ||
| + | |||
| + | <pre> | ||
| + | |||
| + | lock(typeof(TranslateBO)) | ||
| + | { | ||
| + | |||
| + | transBO.getDataByKey(phraseKey); | ||
| + | return transBO.detailData.syPhrase.Find(phraseKey); | ||
| + | } | ||
| + | |||
| + | </pre> | ||
Revision as of 14:42, 23 January 2017
Multithreading
Critical sections should be small
To avoid dead-locks critical sections should be small enough to prove that dead lock is not possible. Critical section should not cover any complicated business task which access database (for example business action).
Please AVOID below construction:
lock(typeof(TranslateBO))
{
transBO.getDataByKey(phraseKey);
return transBO.detailData.syPhrase.Find(phraseKey);
}