From 0d8bb78f66292a7359797de86bbe0e2ff533f460 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 26 Dec 2011 21:56:23 -0800 Subject: [PATCH] Fixed a build failure Added a thread assertion to function.cpp --- fishd.cpp | 4 ++-- function.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fishd.cpp b/fishd.cpp index cb63e6aa1..a1369e515 100644 --- a/fishd.cpp +++ b/fishd.cpp @@ -646,7 +646,7 @@ int main( int argc, char ** argv ) FD_SET( c->fd, &read_fd ); max_fd = maxi( max_fd, c->fd+1); - if( ! q_empty( &c->unsent ) ) + if( ! c->unsent->empty() ) { FD_SET( c->fd, &write_fd ); } @@ -738,7 +738,7 @@ int main( int argc, char ** argv ) { debug( 4, L"Close connection %d", c->fd ); - while( ! c->unsent->empty()) ) + while( ! c->unsent->empty() ) { message_t *msg = c->unsent->front(); c->unsent->pop(); diff --git a/function.cpp b/function.cpp index 52fc333d5..760d05f41 100644 --- a/function.cpp +++ b/function.cpp @@ -123,6 +123,7 @@ static int is_autoload = 0; */ static int load( const wchar_t *name ) { + ASSERT_IS_MAIN_THREAD(); int was_autoload = is_autoload; int res; function_internal_data_t *data; @@ -263,7 +264,7 @@ void function_add( function_data_t *data ) UNLOCK_FUNCTIONS(); } -static int function_exists_internal( const wchar_t *cmd, int autoload ) +static int function_exists_internal( const wchar_t *cmd, bool autoload ) { int res; CHECK( cmd, 0 ); @@ -280,12 +281,12 @@ static int function_exists_internal( const wchar_t *cmd, int autoload ) int function_exists( const wchar_t *cmd ) { - return function_exists_internal( cmd, 1 ); + return function_exists_internal( cmd, true ); } int function_exists_no_autoload( const wchar_t *cmd ) { - return function_exists_internal( cmd, 0 ); + return function_exists_internal( cmd, false ); } void function_remove( const wchar_t *name )