Skip to content
Snippets Groups Projects
design-2.1-lock-acquire.dot 1003 B
digraph "design-2.1-lock-acquire" {
  graph[fontsize=8, fontname="Helvetica"]
  node[fontsize=8, fontname="Helvetica", width="0", height="0"]
  edge[fontsize=8, fontname="Helvetica"]

  /* Actions */
  abort[label="Abort\n(couldn't acquire)"]
  acquire[label="Acquire lock"]
  add_to_queue[label="Add condition to queue"]
  wait[label="Wait for notification"]
  remove_from_queue[label="Remove from queue"]

  /* Conditions */
  alone[label="Empty queue and can acquire?", shape=diamond]
  have_timeout[label="Do I have timeout?", shape=diamond]
  top_of_queue_and_can_acquire[
    label="On top of queue and can acquire lock?",
    shape=diamond,
    ]

  /* Lines */
  alone->acquire[label="Yes"]
  alone->add_to_queue[label="No"]

  have_timeout->abort[label="Yes"]
  have_timeout->wait[label="No"]

  top_of_queue_and_can_acquire->acquire[label="Yes"]
  top_of_queue_and_can_acquire->have_timeout[label="No"]

  add_to_queue->wait
  wait->top_of_queue_and_can_acquire
  acquire->remove_from_queue
}