aboutsummaryrefslogtreecommitdiffhomepage
path: root/autoload.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-31 15:17:14 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-31 15:17:14 -0700
commitff1710131687075e819afcb045ed35924822b682 (patch)
tree19995b23aa1fead26348506212ed5be9c8769359 /autoload.cpp
parentab536e5199e205db9be69866628a1a885cac1475 (diff)
A little better support for non-term-256 colors in web config
Fix for a deadlock when autoloading a function triggers autoloading another function
Diffstat (limited to 'autoload.cpp')
-rw-r--r--autoload.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/autoload.cpp b/autoload.cpp
index 57de29cc..2d1b8394 100644
--- a/autoload.cpp
+++ b/autoload.cpp
@@ -70,28 +70,20 @@ int autoload_t::load( const wcstring &cmd, bool reload )
CHECK_BLOCK( 0 );
ASSERT_IS_MAIN_THREAD();
- env_var_t path_var;
+ env_var_t path_var = env_get_string( env_var_name );
- /* Do some work while locked, including determing the path variable */
+ /*
+ Do we know where to look?
+ */
+ if( path_var.empty() )
+ return 0;
+
+ /* Check if the lookup path has changed. If so, drop all loaded files. path_var may only be inspected on the main thread. */
+ if( path_var != this->last_path )
{
- scoped_lock locker(lock);
- path_var = env_get_string( env_var_name );
-
- /*
- Do we know where to look?
- */
- if( path_var.empty() )
- return 0;
-
- /*
- Check if the lookup path has changed. If so, drop all loaded
- files.
- */
- if( path_var != this->path )
- {
- this->path = path_var;
- this->evict_all_nodes();
- }
+ this->last_path = path_var;
+ scoped_lock locker(lock);
+ this->evict_all_nodes();
}
/** Warn and fail on infinite recursion. It's OK to do this because this function is only called on the main thread. */