Kaydet (Commit) bd4f62df authored tarafından Michael Stahl's avatar Michael Stahl

framework: remove pointless IGate interface and de-virtualize

Change-Id: I43080ab6a4d9530a5cd4e3b8fa7806df41467e51
üst cfade6de
......@@ -20,9 +20,8 @@
#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_GATE_HXX
#define INCLUDED_FRAMEWORK_INC_THREADHELP_GATE_HXX
#include <threadhelp/igate.h>
#include <boost/noncopyable.hpp>
#include <osl/time.h>
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
......@@ -36,13 +35,9 @@ namespace framework{
@attention To prevent us against wrong using, the default ctor, copy ctor and the =operator are marked private!
@implements IGate
@base IGate
@devstatus ready to use
*//*-*************************************************************************************************************/
class Gate : public IGate
, private boost::noncopyable
class Gate : private boost::noncopyable
{
// public methods
......@@ -65,19 +60,18 @@ class Gate : public IGate
blocked threads can running ... but I don't know
if it's right - we are destroyed yet!?
*//*-*****************************************************************************************************/
inline virtual ~Gate()
inline ~Gate()
{
open();
}
/*-****************************************************************************************************
@interface IGate
@short open the gate
@descr A wait() call will not block then.
@seealso method close()
*//*-*****************************************************************************************************/
virtual void open() SAL_OVERRIDE
void open()
{
// We must safe access to our internal member!
::osl::MutexGuard aLock( m_aAccessLock );
......@@ -89,13 +83,12 @@ class Gate : public IGate
}
/*-****************************************************************************************************
@interface IGate
@short close the gate
@descr A wait() call will block then.
@seealso method open()
*//*-*****************************************************************************************************/
virtual void close() SAL_OVERRIDE
void close()
{
// We must safe access to our internal member!
::osl::MutexGuard aLock( m_aAccessLock );
......@@ -107,7 +100,6 @@ class Gate : public IGate
}
/*-****************************************************************************************************
@interface IGate
@short must be called to pass the gate
@descr If gate "open" => wait() will not block.
If gate "closed" => wait() will block till somewhere open it again.
......@@ -121,7 +113,7 @@ class Gate : public IGate
@onerror We return false.
*//*-*****************************************************************************************************/
virtual bool wait( const TimeValue* pTimeOut = NULL ) SAL_OVERRIDE
bool wait(const TimeValue* pTimeOut = nullptr)
{
// We must safe access to our internal member!
::osl::ClearableMutexGuard aLock( m_aAccessLock );
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you 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 .
*/
#ifndef INCLUDED_FRAMEWORK_INC_THREADHELP_IGATE_H
#define INCLUDED_FRAMEWORK_INC_THREADHELP_IGATE_H
#include <osl/time.h>
namespace framework{
/*-************************************************************************************************************
@descr We need this interface to support using of different gate implementations in a generic way.
*//*-*************************************************************************************************************/
class IGate
{
// public methods
public:
/*-****************************************************************************************************
@descr These functions must be supported by a derived class!
open() -open access for all waiting threads
close() -close access for all further coming threads
wait() -must be called to pass the gate
*//*-*****************************************************************************************************/
virtual void open ( ) = 0;
virtual void close ( ) = 0;
virtual bool wait ( const TimeValue* pTimeOut = NULL ) = 0;
protected:
~IGate() {}
}; // class IGate
} // namespace framework
#endif // INCLUDED_FRAMEWORK_INC_THREADHELP_IGATE_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment