Libraryless. Click here for Pure Java version (2945L/18K).
1 | sbool addToQIfEmpty(Q q, Runnable r) {
|
2 | if (q == null || r == null) false; |
3 | synchronized(q.mutex()) {
|
4 | if (q.isEmpty()) |
5 | ret true with q.add(r); |
6 | false; |
7 | } |
8 | } |
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: | 504 / 678 |
| Referenced in: | [show references] |