Created
February 1, 2017 02:43
-
-
Save rukletsov/929d86d0dc6e3ecbb50f10667c4dfef2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool wait(const UPID& pid, const Duration& duration) | |
{ | |
process::initialize(); | |
if (!pid) { | |
return false; | |
} | |
// This could result in a deadlock if some code decides to wait on a | |
// process that has invoked that code! | |
if (__process__ != nullptr && __process__->self() == pid) { | |
std::cerr << "\n**** DEADLOCK DETECTED! ****\nYou are waiting on process " | |
<< pid << " that it is currently executing." << std::endl; | |
((Promise<Nothing>*)0xDEAD)->future(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment