Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1031843 // ExternalMutex

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (47L/1K).

1  
sclass ExternalMutex /*implements AutoCloseable*/ {
2  
  int referenceCount;
3  
  
4  
  void incRefCount {
5  
    referenceCount++;
6  
    ifdef ExternalMutex_debug
7  
      print(toStringWithIdentity(this) + " referenceCount++ => " + referenceCount);
8  
    endifdef
9  
  }
10  
  
11  
  int decRefCount() {
12  
    --referenceCount;
13  
    ifdef ExternalMutex_debug
14  
      print(toStringWithIdentity(this) + " referenceCount-- => " + referenceCount);
15  
    endifdef
16  
    ret referenceCount;
17  
  }
18  
  
19  
  /*public void close {
20  
    var map = externalMutexMap();
21  
    synchronized(map) {
22  
      if (--referenceCount == 0)
23  
        map.remove(this);
24  
    }
25  
  }*/
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031843
Snippet name: ExternalMutex
Eternal ID of this version: #1031843/6
Text MD5: d4f4fa2e7aacea6e56ddd0a1093981d2
Transpilation MD5: 62bd41dcfd997f3f8b56ab703dd61ec1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-07-16 06:03:52
Source code size: 635 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 100 / 233
Version history: 5 change(s)
Referenced in: [show references]