diff --git a/config b/config index a7a737445..3eb2105cb 100644 --- a/config +++ b/config @@ -93,6 +93,24 @@ fi # linker errors, so disable it here. CFLAGS="$CFLAGS -DSERF_HTTPS_FETCHING=0 $FLAG_MARCH" +case "$NGX_GCC_VER" in + 4.8*) + # On GCC 4.8 and above, -Wall enables -Wunused-local-typedefs. This breaks + # on VerifySizesAreEqual in bit_cast in chromium/src/base/basictypes.h which + # has a typedef that is intentionally unused. + CFLAGS="$CFLAGS -Wno-unused-local-typedefs" + + # On GCC 4.8 and above, we get the following compiler warning: + # chromium/src/base/memory/scoped_ptr.h:133:7: warning: declaration of ‘class scoped_ptr’ [enabled by default] + # Based on discussion at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54055, + # this is invalid code, but hasn't been fixed yet in chromium. + # Unfortunately, there also does not appear to be a flag for just disabling + # that warning, so we add Wno-error to override nginx's default -Werror + # option. + CFLAGS="$CFLAGS -Wno-error" + ;; +esac + pagespeed_include="\ $mod_pagespeed_dir \ $mod_pagespeed_dir/third_party/chromium/src \ diff --git a/src/ngx_thread_system.cc b/src/ngx_thread_system.cc new file mode 100644 index 000000000..a5f3ca50e --- /dev/null +++ b/src/ngx_thread_system.cc @@ -0,0 +1,46 @@ +/* + * Copyright 2013 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Author: jefftk@google.com (Jeff Kaufman) + +#include "ngx_thread_system.h" + +#include "apr_thread_proc.h" + +namespace net_instaweb { + +class Timer; + +NgxThreadSystem::NgxThreadSystem() : may_start_threads_(false) {} + +NgxThreadSystem::~NgxThreadSystem() {} + +void NgxThreadSystem::PermitThreadStarting() { + DCHECK(!may_start_threads_); + may_start_threads_ = true; +} + +void NgxThreadSystem::BeforeThreadRunHook() { + // We disable all signals here, since the nginx worker process is expecting to + // catch them and pagespeed doesn't use signals. + apr_setup_signal_thread(); + + // If this fails you can get a backtrace from gdb by setting a breakpoint on + // "pthread_create". + DCHECK(may_start_threads_); +} + +} // namespace net_instaweb