original_string: protected function makeDirectorySafe($dir)
      {
          $count = 0;
  
          if (is_dir($dir)) {
              if (!is_writable($dir)) {
                  throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
              }
  
              return;
          }
  
          while (!is_dir($dir) && !@mkdir($dir, 0777, true)) {
              usleep(rand(50000, 200000));
  
              if ($count++ > 10) {
                  throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
              }
          }
  
          File::chmodRecursive($dir);
      }
code: protected function makeDirectorySafe($dir)
      {
          $count = 0;
  
          if (is_dir($dir)) {
              if (!is_writable($dir)) {
                  throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
              }
  
              return;
          }
  
          while (!is_dir($dir) && !@mkdir($dir, 0777, true)) {
              usleep(rand(50000, 200000));
  
              if ($count++ > 10) {
                  throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
              }
          }
  
          File::chmodRecursive($dir);
      }
code_tokens: protected function makeDirectorySafe ( $ dir ) { $ count = 0 ; if ( is_dir ( $ dir ) ) { if ( ! is_writable ( $ dir ) ) { throw new SystemException ( Lang :: get ( 'system::lang.directory.create_fail' , [ 'name' => $ dir ] ) ) ; } return ; } while ( ! is_dir ( $ dir ) && ! @ mkdir ( $ dir , 0777 , true ) ) { usleep ( rand ( 50000 , 200000 ) ) ; if ( $ count ++ > 10 ) { throw new SystemException ( Lang :: get ( 'system::lang.directory.create_fail' , [ 'name' => $ dir ] ) ) ; } } File :: chmodRecursive ( $ dir ) ; }
docstring: Make directory with concurrency support
docstring_tokens: Make directory with concurrency support