But now my non-technical friends (and parents for that matter) don't give me urls starting with... "h.. t.. t.. p.. colon backslash, or wait? maybe its a foward slash.. w.. w.. w.. " etc.
ness2u2
Posts
-
Microsoft's arrogance with IE9 -
while (true) and for (; ; ) [modified]Depending on the language and framework's your using, there is probably a timer you could use to avoid the loop all together? If the bulk of the code in the loop is critical enough to require a lock, I wonder if it is something that would actually benefit from running in a multithreaded environment? I work mostly with C# and have seen very few scenarios where while(true) or for(;;) is the best choice. Just make sure its commented well!
-
while (true) and for (; ; ) [modified]Andrew Glow wrote:
while(true)
{
lock(syncObject)
{
if (checkSomeCriticalCondition())
break;
}doSomeOtherStuff();
}If possible, I'd move the lock{ someCriticalCondition } out to a function returning boolean. Then toss the result of that as the while condition. while(CheckCondition()){ doSomeOtherStuff(); } The semantics are identical, unless there is code before the lock... In my opinion, this displays the intent of code/loop better than having an internal break.