1 /******************************************************************************* 2 3 Interface for the timeout manager expiry registration object used in the 4 ISelectClient. 5 6 The reason for these interfaces is to avoid requiring an application to be 7 linked against the libebtree, which is required by TimeoutManager and 8 ExpiryRegistration, when it uses a library module that supports a timeout 9 functionality as an optional feature. 10 Therefore, library modules that support a timeout functionality as an 11 optional feature should always use these interfaces and not import 12 TimeoutManager/ExpiryRegistration. 13 14 Copyright: 15 Copyright (c) 2009-2016 dunnhumby Germany GmbH. 16 All rights reserved. 17 18 License: 19 Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. 20 Alternatively, this file may be distributed under the terms of the Tango 21 3-Clause BSD License (see LICENSE_BSD.txt for details). 22 23 *******************************************************************************/ 24 25 module ocean.time.timeout.model.IExpiryRegistration; 26 27 28 29 import ocean.meta.types.Qualifiers; 30 import ocean.time.timeout.model.ITimeoutClient; 31 32 /******************************************************************************* 33 34 General timeout manager expiry registration object interface 35 36 *******************************************************************************/ 37 38 interface IExpiryRegistration 39 { 40 /*************************************************************************** 41 42 Sets the timeout for the client and registers it with the timeout 43 manager. On timeout the client will automatically be unregistered. 44 The client must not currently be registered. 45 46 Params: 47 timeout_us = timeout in microseconds from now. 0 is ignored. 48 49 Returns: 50 true if registered or false if timeout_us is 0. 51 52 ***************************************************************************/ 53 54 bool register ( ulong timeout_us ); 55 56 /*************************************************************************** 57 58 Unregisters the current client. 59 If a client is currently not registered, nothing is done. 60 It depends from the implementation whether the client remains 61 associated to this registration or not. 62 63 Must not be called from within timeout(). 64 65 Returns: 66 true on success or false if no client was registered. 67 68 ***************************************************************************/ 69 70 bool unregister ( ); 71 72 /*************************************************************************** 73 74 Returns: 75 true if the client has timed out or false otherwise. 76 77 ***************************************************************************/ 78 79 bool timed_out ( ); 80 81 /*************************************************************************** 82 83 Invoked by the timeout manager when the client times out. Invokes the 84 timeout() method of the current client. 85 86 Returns: 87 the current client which has been notified about its timeout. 88 89 ***************************************************************************/ 90 91 ITimeoutClient timeout ( ); 92 93 /*************************************************************************** 94 95 Identifier string for debugging. 96 97 ***************************************************************************/ 98 99 debug cstring id ( ); 100 }