diff options
Diffstat (limited to 'apps/files/js/semaphore.js')
-rw-r--r-- | apps/files/js/semaphore.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/apps/files/js/semaphore.js b/apps/files/js/semaphore.js deleted file mode 100644 index aa327e0f8a1..00000000000 --- a/apps/files/js/semaphore.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018 - * - * This file is licensed under the Affero General Public License version 3 - * or later. - * - * See the COPYING-README file. - * - */ - -(function(){ - var Semaphore = function(max) { - var counter = 0; - var waiting = []; - - this.acquire = function() { - if(counter < max) { - counter++; - return new Promise(function(resolve) { resolve(); }); - } else { - return new Promise(function(resolve) { waiting.push(resolve); }); - } - }; - - this.release = function() { - counter--; - if (waiting.length > 0 && counter < max) { - counter++; - var promise = waiting.shift(); - promise(); - } - }; - }; - - // needed on public share page to properly register this - if (!OCA.Files) { - OCA.Files = {}; - } - OCA.Files.Semaphore = Semaphore; - -})(); |