Lock the mex file to avoid Matlab crashes.

Commands like "clear all" and "clear function" causes segmentation faults or errors like these (especially after an 'init'):
 libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: caffe/proto/caffe.proto
 libprotobuf FATAL google/protobuf/descriptor.cc:862] CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
 [libprotobuf ERROR google/protobuf/message.cc:333] Type appears to be in generated pool but wasn't registered: caffe.LayerParameter
 Attempt to restart MATLAB?
To avoid these, lock the the mex file.
Display averaged loss over the last several iterations
fix warning
running factory.
more docs
Pre-lunch fun: add a dynamic library guard test.
Add back static library. Using -Wl,--whole-archive will allow us to preserve all symbols.
Mute factory registration message
cmake.
consolidate duplicate code
add long-ignored threshold layer
add explicit declaration - does that help the flakyness?
static initialization order fiasco
Changed linking order: -pthread -> back.
Otherwise error:
/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
doxygen
Merge pull request #1167 from Yangqing/factory

Layer factory.
test_gradient_based_solver.cpp: removed unused typedefs
make HDF5 layer support multiple data output
added test case to cover new HDF5 behavior
Merge pull request #1183 from pluskid/hdf5layer