/*
 * Copyright 2009- ECMWF.
 *
 * This software is licensed under the terms of the Apache Licence version 2.0
 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
 * In applying this licence, ECMWF does not waive the privileges and immunities
 * granted to it by virtue of its status as an intergovernmental organisation
 * nor does it submit to any jurisdiction.
 */

#include "ServerDefsAccess.hpp"

#include "ServerHandler.hpp"

ServerDefsAccess::ServerDefsAccess(ServerHandler* server) : server_(server) {
    server_->defsMutex_.lock(); // lock the resource on construction
}

ServerDefsAccess::~ServerDefsAccess() {
    server_->defsMutex_.unlock(); // unlock the resource on destruction
}

defs_ptr ServerDefsAccess::defs() {
    return server_->defs(); // the resource will always be locked when we use it
}
