leveldb/port
costan 05709fb43e Remove InitOnce from the port API.
This is not an API-breaking change, because it reduces the API that the
leveldb embedder must implement. The project will build just fine
against ports that still implement InitOnce.

C++11 guarantees thread-safe initialization of static variables inside
functions. This is a more restricted form of std::call_once or
pthread_once_t (e.g., single call site), so the compiler might be able
to generate better code [1]. Equally important, having less code in
port_example.h makes it easier to port to other platforms.

Due to the change above, this CL introduces a new approach for storing
the singleton BytewiseComparatorImpl instance returned by
BytewiseComparator(). The new approach avoids a dynamic memory
allocation, which eliminates the false positive from LeakSanitizer
reported in https://github.com/google/leveldb/issues/200

[1] https://stackoverflow.com/a/27206650/

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212348004
2018-09-10 19:04:59 -07:00
..
win reverting disastrous MOE commit, returning to r21 2011-04-19 23:11:15 +00:00
atomic_pointer.h Take <atomic> for granted in port/atomic_pointer.h. 2018-03-21 09:40:40 -07:00
port_config.h.in Take <atomic> for granted in port/atomic_pointer.h. 2018-03-21 09:40:40 -07:00
port_example.h Remove InitOnce from the port API. 2018-09-10 19:04:59 -07:00
port_stdcxx.h Remove InitOnce from the port API. 2018-09-10 19:04:59 -07:00
port.h Replace port_posix with port_stdcxx. 2018-04-17 13:26:47 -07:00
README Replace port_posix with port_stdcxx. 2018-04-17 13:26:47 -07:00
thread_annotations.h Enable thread safety annotations in open source version. 2018-02-13 22:40:41 -08:00

This directory contains interfaces and implementations that isolate the
rest of the package from platform details.

Code in the rest of the package includes "port.h" from this directory.
"port.h" in turn includes a platform specific "port_<platform>.h" file
that provides the platform specific implementation.

See port_stdcxx.h for an example of what must be provided in a platform
specific header file.