Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
wow
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <iostream> #include <mutex> std::unique_lock<std::mutex> with(std::mutex& m) { return std::unique_lock<std::mutex>(m); } bool sink(std::unique_lock<std::mutex> lk) { return true; // the lock is automatically released at the end of this scope, for real this time } std::mutex m; int main() { bool result = sink(with(m)) && sink(with(m)); std::cout << "No deadlock!\n"; return !result; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,82 sec, absolute running time: 0,22 sec, absolute service time: 2,05 sec
edit mode
|
history
No deadlock!