| 24 | // spawn, a message send, a wait, and two user-space context-switchs. |
| 25 | |
| 26 | Latch::Latch() : triggered(false) |
| 27 | { |
| 28 | // Deadlock is possible if one thread is trying to delete a latch |
| 29 | // but the libprocess thread(s) is trying to acquire a resource the |
| 30 | // deleting thread is holding. Hence, we only save the PID for |
| 31 | // triggering the latch and let the GC actually do the deleting |
| 32 | // (thus no waiting is necessary, and deadlocks are avoided). |
| 33 | pid = spawn(new ProcessBase(ID::generate("__latch__")), true); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | Latch::~Latch() |