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

8
LINES

< > BotCompany Repo | #1026889 // addToQIfEmpty - perform atomic check on whether queue is empty

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

Libraryless. Click here for Pure Java version (2945L/18K).

sbool addToQIfEmpty(Q q, Runnable r) {
  if (q == null || r == null) false;
  synchronized(q.mutex()) {
    if (q.isEmpty())
      ret true with q.add(r);
    false;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026889
Snippet name: addToQIfEmpty - perform atomic check on whether queue is empty
Eternal ID of this version: #1026889/1
Text MD5: 398216f77cec70e06c1daa7f944147ba
Transpilation MD5: 550748d4b86b39c713d18b43186a8615
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-02 14:30:33
Source code size: 178 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 410
Referenced in: [show references]