Share a value between two different hooks
In Drupal 7, drupal_static() could be used too, if the stored value doesn't need to be persistent between different pages.

drupal_static() is normally called as drupal_static(__FUNCTION__, $default_value), but if you use the name of the function, you can access the same value accessed from the function that calls drupal_static().

Using variable_set() and variable_get() the value is persistent between different pages, and it is not automatically removed. If the first hook execute code similar to the following one, then the second module would get an older value.

if ($condition) {
  variable_set($variable_name, $value);
}


Rather than using such code, the first hook should execute code similar to the following one.

if ($condition) {
  variable_set($variable_name, $value);
}
else {
  variable_del($variable_name);
}


Whatever method you choose, be sure the hook reading the value is effectively running after the hook setting that value.