org.scalatest.concurrent.Signaler.scala Maven / Gradle / Ivy
The newest version!
/* * Copyright 2001-2013 Artima, Inc. * * Licensed 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 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.scalatest.concurrent /** * Strategy for signaling an operation after a timeout expires. * *Unit. */ object Signaler { /** * Factory method for a* An instance of this trait is used for configuration when using traits *
*/ trait Signaler { /** * Signals an operation. * *TimeLimitsandTimeLimitedTests. ** This method may do anything to attempt to signal or interrupt an operation, or even do nothing. * When called by
*/ def apply(testThread: Thread): Unit } /** * Companion object that provides a factory method for afailAftermethod of traitTimeLimits, the passed *Threadwill represent the main test thread. ThisThreadis * passed in case it is useful, but need not be used by implementations of this method. *Singlaerdefined * in terms of a function from a function of typeThreadtoSignallerdefined in terms of a function from a function of * typeThreadto Unit. * * When thisapplymethod is invoked, it will invoke the passed function'sapply* method, forwarding along the passedThread. * * @param fun the function representing the signaling strategy */ def apply(fun: Thread => Unit) = new Signaler { def apply(testThread: Thread): Unit = { fun(testThread) } } /** * ImplicitSignalervalue defining a default signaling strategy for thefailAfterandcancelAftermethod * of trait [[org.scalatest.concurrent.TimeLimits]]. */ implicit def default: Signaler = DoNotSignal }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy