1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
//-----------------------------------------------
// my own includes
#include <algorithm>
#include <helper/statusindicatorfactory.hxx>
#include <helper/statusindicator.hxx>
#include <helper/vclstatusindicator.hxx>
#include <threadhelp/writeguard.hxx>
#include <threadhelp/readguard.hxx>
#include <services.h>
#include <properties.h>
//-----------------------------------------------
// interface includes
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XLayoutConstrains.hpp>
#include <com/sun/star/awt/DeviceInfo.hpp>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <toolkit/unohlp.hxx>
//-----------------------------------------------
// includes of other projects
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/configurationhelper.hxx>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
//-----------------------------------------------
// namespace
namespace framework{
//-----------------------------------------------
// definitions
sal_Int32 StatusIndicatorFactory::m_nInReschedule = 0; /// static counter for rescheduling
static ::rtl::OUString PROGRESS_RESOURCE(RTL_CONSTASCII_USTRINGPARAM("private:resource/progressbar/progressbar"));
//-----------------------------------------------
DEFINE_XINTERFACE_5(StatusIndicatorFactory ,
OWeakObject ,
DIRECT_INTERFACE(css::lang::XTypeProvider ),
DIRECT_INTERFACE(css::lang::XServiceInfo ),
DIRECT_INTERFACE(css::lang::XInitialization ),
DIRECT_INTERFACE(css::task::XStatusIndicatorFactory),
DIRECT_INTERFACE(css::util::XUpdatable ))
DEFINE_XTYPEPROVIDER_5(StatusIndicatorFactory ,
css::lang::XTypeProvider ,
css::lang::XServiceInfo ,
css::lang::XInitialization ,
css::task::XStatusIndicatorFactory,
css::util::XUpdatable )
DEFINE_XSERVICEINFO_MULTISERVICE(StatusIndicatorFactory ,
::cppu::OWeakObject ,
SERVICENAME_STATUSINDICATORFACTORY ,
IMPLEMENTATIONNAME_STATUSINDICATORFACTORY)
DEFINE_INIT_SERVICE(StatusIndicatorFactory,
{
/*Attention
I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
to create a new instance of this class by our own supported service factory.
see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations!
*/
}
)
//-----------------------------------------------
StatusIndicatorFactory::StatusIndicatorFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
: ThreadHelpBase ( )
, ::cppu::OWeakObject ( )
, m_xSMGR (xSMGR )
, m_pWakeUp (0 )
, m_bAllowReschedule (sal_False)
, m_bAllowParentShow (sal_False)
, m_bDisableReschedule(sal_False)
{
}
//-----------------------------------------------
StatusIndicatorFactory::~StatusIndicatorFactory()
{
impl_stopWakeUpThread();
}
//-----------------------------------------------
void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
throw(css::uno::Exception ,
css::uno::RuntimeException)
{
::comphelper::SequenceAsHashMap lArgs(lArguments);
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
m_xFrame = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_FRAME , css::uno::Reference< css::frame::XFrame >());
m_xPluggWindow = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_WINDOW , css::uno::Reference< css::awt::XWindow >() );
m_bAllowParentShow = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW , (sal_Bool)sal_False );
m_bDisableReschedule = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_DISABLERESCHEDULE, (sal_Bool)sal_False );
aWriteLock.unlock();
// <- SAFE ----------------------------------
impl_createProgress();
}
//-----------------------------------------------
css::uno::Reference< css::task::XStatusIndicator > SAL_CALL StatusIndicatorFactory::createStatusIndicator()
throw(css::uno::RuntimeException)
{
StatusIndicator* pIndicator = new StatusIndicator(this);
css::uno::Reference< css::task::XStatusIndicator > xIndicator(static_cast< ::cppu::OWeakObject* >(pIndicator), css::uno::UNO_QUERY_THROW);
return xIndicator;
}
//-----------------------------------------------
void SAL_CALL StatusIndicatorFactory::update()
throw(css::uno::RuntimeException)
{
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
m_bAllowReschedule = sal_True;
aWriteLock.unlock();
// <- SAFE ----------------------------------
}
//-----------------------------------------------
void StatusIndicatorFactory::start(const css::uno::Reference< css::task::XStatusIndicator >& xChild,
const ::rtl::OUString& sText ,
sal_Int32 nRange)
{
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
// create new info structure for this child or move it to the front of our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
m_aStack.erase(pItem);
IndicatorInfo aInfo(xChild, sText, nRange);
m_aStack.push_back (aInfo );
m_xActiveChild = xChild;
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
aWriteLock.unlock();
// <- SAFE ----------------------------------
implts_makeParentVisibleIfAllowed();
if (xProgress.is())
xProgress->start(sText, nRange);
impl_startWakeUpThread();
impl_reschedule(sal_True);
}
//-----------------------------------------------
void StatusIndicatorFactory::reset(const css::uno::Reference< css::task::XStatusIndicator >& xChild)
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
// reset the internal info structure related to this child
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
{
pItem->m_nValue = 0;
pItem->m_sText = ::rtl::OUString();
}
css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
aReadLock.unlock();
// <- SAFE ----------------------------------
// not the top most child => dont change UI
// But dont forget Reschedule!
if (
(xChild == xActive) &&
(xProgress.is() )
)
xProgress->reset();
impl_reschedule(sal_True);
}
//-----------------------------------------------
void StatusIndicatorFactory::end(const css::uno::Reference< css::task::XStatusIndicator >& xChild)
{
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
// remove this child from our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
m_aStack.erase(pItem);
// activate next child ... or finish the progress if there is no further one.
m_xActiveChild.clear();
::rtl::OUString sText;
sal_Int32 nValue = 0;
IndicatorStack::reverse_iterator pNext = m_aStack.rbegin();
if (pNext != m_aStack.rend())
{
m_xActiveChild = pNext->m_xIndicator;
sText = pNext->m_sText;
nValue = pNext->m_nValue;
}
css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
aWriteLock.unlock();
// <- SAFE ----------------------------------
if (xActive.is())
{
// There is at least one further child indicator.
// Actualize our progress, so it shows these values from now.
if (xProgress.is())
{
xProgress->setText (sText );
xProgress->setValue(nValue);
}
}
else
{
// Our stack is empty. No further child exists.
// Se we must "end" our progress realy
if (xProgress.is())
xProgress->end();
// Now hide the progress bar again.
impl_hideProgress();
impl_stopWakeUpThread();
}
impl_reschedule(sal_True);
}
//-----------------------------------------------
void StatusIndicatorFactory::setText(const css::uno::Reference< css::task::XStatusIndicator >& xChild,
const ::rtl::OUString& sText )
{
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
pItem->m_sText = sText;
css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
aWriteLock.unlock();
// SAFE -> ----------------------------------
// paint only the top most indicator
// but dont forget to Reschedule!
if (
(xChild == xActive) &&
(xProgress.is() )
)
{
xProgress->setText(sText);
}
impl_reschedule(sal_True);
}
//-----------------------------------------------
void StatusIndicatorFactory::setValue( const css::uno::Reference< css::task::XStatusIndicator >& xChild ,
sal_Int32 nValue )
{
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
sal_Int32 nOldValue = 0;
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
if (pItem != m_aStack.end())
{
nOldValue = pItem->m_nValue;
pItem->m_nValue = nValue;
}
css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
aWriteLock.unlock();
// SAFE -> ----------------------------------
if (
(xChild == xActive) &&
(nOldValue != nValue ) &&
(xProgress.is() )
)
{
xProgress->setValue(nValue);
}
impl_reschedule(sal_False);
}
//-----------------------------------------------
void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
if (!m_bAllowParentShow)
return;
css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
css::uno::Reference< css::awt::XWindow > xPluggWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR.get(), css::uno::UNO_QUERY);
aReadLock.unlock();
// <- SAFE ----------------------------------
css::uno::Reference< css::awt::XWindow > xParentWindow;
if (xFrame.is())
xParentWindow = xFrame->getContainerWindow();
else
xParentWindow = xPluggWindow;
// dont disturb user in case he put the loading document into the background!
// Supress any setVisible() or toFront() call in case the initial show was
// already made.
css::uno::Reference< css::awt::XWindow2 > xVisibleCheck(xParentWindow, css::uno::UNO_QUERY);
sal_Bool bIsVisible = sal_False;
if (xVisibleCheck.is())
bIsVisible = xVisibleCheck->isVisible();
if (bIsVisible)
{
impl_showProgress();
return;
}
// Check if the layout manager has been set to invisible state. It this case we are also
// not allowed to set the frame visible!
css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
if (xPropSet.is())
{
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
if (xLayoutManager.is())
{
if ( !xLayoutManager->isVisible() )
return;
}
}
// Ok the window should be made visible ... becuase it isnt currently visible.
// BUT ..!
// We need a Hack for our applications: They get her progress from the frame directly
// on saving documents. Because there is no progress set on the MediaDescriptor.
// But that's wrong. In case the document was opened hidden, they shouldnt use any progress .-(
// They only possible workaround: dont show the parent window here, if the document was opened hidden.
sal_Bool bHiddenDoc = sal_False;
if (xFrame.is())
{
css::uno::Reference< css::frame::XController > xController;
css::uno::Reference< css::frame::XModel > xModel ;
xController = xFrame->getController();
if (xController.is())
xModel = xController->getModel();
if (xModel.is())
{
::comphelper::MediaDescriptor lDocArgs(xModel->getArgs());
bHiddenDoc = lDocArgs.getUnpackedValueOrDefault(
::comphelper::MediaDescriptor::PROP_HIDDEN(),
(sal_Bool)sal_False);
}
}
if (bHiddenDoc)
return;
// OK: The document was not opened in hidden mode ...
// and the window isnt already visible.
// Show it and bring it to front.
// But before we have to be sure, that our internal used helper progress
// is visible too.
impl_showProgress();
SolarMutexGuard aSolarGuard;
Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( pWindow )
{
bool bForceFrontAndFocus(false);
::comphelper::ConfigurationHelper::readDirectKey(
xSMGR,
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/View")),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NewDocumentHandling")),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ForceFocusAndToFront")),
::comphelper::ConfigurationHelper::E_READONLY) >>= bForceFrontAndFocus;
pWindow->Show(sal_True, bForceFrontAndFocus ? SHOW_FOREGROUNDTASK : 0 );
}
}
//-----------------------------------------------
void StatusIndicatorFactory::impl_createProgress()
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
css::uno::Reference< css::awt::XWindow > xWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
aReadLock.lock();
// <- SAFE ----------------------------------
css::uno::Reference< css::task::XStatusIndicator > xProgress;
if (xWindow.is())
{
// use vcl based progress implementation in plugged mode
VCLStatusIndicator* pVCLProgress = new VCLStatusIndicator(xSMGR, xWindow);
xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pVCLProgress), css::uno::UNO_QUERY);
}
else
if (xFrame.is())
{
// use frame layouted progress implementation
css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
if (xPropSet.is())
{
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
if (xLayoutManager.is())
{
xLayoutManager->lock();
xLayoutManager->createElement( PROGRESS_RESOURCE );
xLayoutManager->hideElement( PROGRESS_RESOURCE );
css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(PROGRESS_RESOURCE);
if (xProgressBar.is())
xProgress = css::uno::Reference< css::task::XStatusIndicator >(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
xLayoutManager->unlock();
}
}
}
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
m_xProgress = xProgress;
aWriteLock.lock();
// <- SAFE ----------------------------------
}
//-----------------------------------------------
void StatusIndicatorFactory::impl_showProgress()
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
css::uno::Reference< css::awt::XWindow > xWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
aReadLock.lock();
// <- SAFE ----------------------------------
css::uno::Reference< css::task::XStatusIndicator > xProgress;
if (xFrame.is())
{
// use frame layouted progress implementation
css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
if (xPropSet.is())
{
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
if (xLayoutManager.is())
{
// Be sure that we have always a progress. It can be that our frame
// was recycled and therefore the progress was destroyed!
// CreateElement does nothing if there is already a valid progress.
xLayoutManager->createElement( PROGRESS_RESOURCE );
xLayoutManager->showElement( PROGRESS_RESOURCE );
css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(PROGRESS_RESOURCE);
if (xProgressBar.is())
xProgress = css::uno::Reference< css::task::XStatusIndicator >(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
}
}
// SAFE -> ----------------------------------
WriteGuard aWriteLock(m_aLock);
m_xProgress = xProgress;
aWriteLock.lock();
// <- SAFE ----------------------------------
}
}
//-----------------------------------------------
void StatusIndicatorFactory::impl_hideProgress()
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
css::uno::Reference< css::awt::XWindow > xWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
aReadLock.lock();
// <- SAFE ----------------------------------
if (xFrame.is())
{
// use frame layouted progress implementation
css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
if (xPropSet.is())
{
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
if (xLayoutManager.is())
xLayoutManager->hideElement( PROGRESS_RESOURCE );
}
}
}
//-----------------------------------------------
void StatusIndicatorFactory::impl_reschedule(sal_Bool bForce)
{
// SAFE ->
ReadGuard aReadLock(m_aLock);
if (m_bDisableReschedule)
return;
aReadLock.unlock();
// <- SAFE
sal_Bool bReschedule = bForce;
if (!bReschedule)
{
// SAFE ->
WriteGuard aWriteLock(m_aLock);
bReschedule = m_bAllowReschedule;
m_bAllowReschedule = sal_False;
aWriteLock.unlock();
// <- SAFE
}
if (!bReschedule)
return;
// SAFE ->
WriteGuard aGlobalLock(LockHelper::getGlobalLock());
if (m_nInReschedule == 0)
{
++m_nInReschedule;
aGlobalLock.unlock();
// <- SAFE
Application::Reschedule(true);
// SAFE ->
aGlobalLock.lock();
--m_nInReschedule;
}
}
//-----------------------------------------------
void StatusIndicatorFactory::impl_startWakeUpThread()
{
// SAFE ->
WriteGuard aWriteLock(m_aLock);
if (m_bDisableReschedule)
return;
if (!m_pWakeUp)
{
m_pWakeUp = new WakeUpThread(this);
m_pWakeUp->create();
}
aWriteLock.unlock();
// <- SAFE
}
//-----------------------------------------------
void StatusIndicatorFactory::impl_stopWakeUpThread()
{
// SAFE ->
WriteGuard aWriteLock(m_aLock);
if (m_pWakeUp)
{
// Thread kill itself after terminate()!
m_pWakeUp->terminate();
m_pWakeUp = 0;
}
aWriteLock.unlock();
// <- SAFE
}
} // namespace framework
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|