The Apache Mynewt OS has just been released (v1.0). It’s an IoT operating system than works on, amongst other platforms, the Nordic Semiconductor nRF51 and nRF52 SoC that’s commonly used in beacons.
The OS has a Bluetooth 4.2 compliant stack that provides for simultaneous advertising, scanning, GATT and concurrent multiple roles (master(central)/slave(peripheral), server/client).