Minimize lock time

Kagamin spam at here.lot
Wed Jun 9 23:54:37 PDT 2010


Let's consider the following code:

synchronized(syncRoot)
{
  if(condition)opSuccess();
  else writeln(possibly,slow);
}

Suppose the else close doesn't need to be executed in lock domain and can be slow. How to minimize lock time here?

synchronized(syncRoot)
{
  if(condition)opSuccess();
  else goto Lwrite;
}
Lwrite: writeln(possibly,slow);

We can do this... but...


More information about the Digitalmars-d-learn mailing list