aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/semaphore.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/semaphore.js')
-rw-r--r--apps/files/js/semaphore.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/apps/files/js/semaphore.js b/apps/files/js/semaphore.js
deleted file mode 100644
index 3e0d61e922a..00000000000
--- a/apps/files/js/semaphore.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-(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;
-
-})();