summaryrefslogtreecommitdiff
path: root/src/library/scala/concurrent
Commit message (Collapse)AuthorAgeFilesLines
* Improving ScalaDoc for ExecutionContext and Await.Viktor Klang2017-03-292-26/+59
|
* Improve List creation in BatchingExecutorJohannes Rudolph2017-03-221-1/+1
| | | It turned up in play profiling.
* Fix how "sbt" is writtenDale Wijnand2016-12-211-2/+2
| | | | | | | | "sbt" is not an acronym (it used to be, but it isn't any longer). It's a proper name, like "iPhone" or "eBay". So, just like you wouldn't write "Get Started With EBay" or "How To Reset Your IPhone", we don't write "Using the Sbt Build".
* Modules w. serializable type alias "companions" are not serializableJason Zaugg2016-12-141-2/+2
| | | | | | | | | | | | | | | | | | The behaviour changed in #5550, this commit adapts to the change so that we'll be binary compatible after boostrapping. MiMa alerted us to a change in the parentage of two objects in the forkjoin package object. In Scala 2.12.0/1, they implemented `scala.Serializable`. Recently, this (synthetically added) parent was absent. This appears to be due to a bug fix in `companionSymbolOf`, which no longer treats objects and same-named type aliases to be companions. This commit manually adds the formerly-synthetic parents to these objects, and documents the change in compiler behaviour with a test. Fixes scala/scala-dev#290
* Merge pull request #5481 from som-snytt/issue/10007-processLukas Rytz2016-11-181-2/+2
|\ | | | | SI-10007 sys.process thread sync
| * SI-10007 sys.process thread syncSom Snytt2016-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous change to replace `SyncVar.set` with `SyncVar.put` breaks things. This commit tweaks the thread synchronizing in `sys.process` to actually use `SyncVar` to sync and pass a var. Joining the thread about to exit is superfluous. A result is put exactly once, and consumers use non-destructive `get`. Note that as usual, avoid kicking off threads in a static context, since class loading cycles are somewhat dicier with 2.12 lambdas. In particular, REPL is a static context by default. SI-10007 Clarify deprecation message The message on `set` was self-fulfilling, as it didn't hint that `put` has different semantics. So explain why `put` helps avoid errors instead of creating them. SI-10007 Always set exit value Always put a value to exit code, defaulting to None. Also clean up around tuple change to unfortunately named Future.apply. Very hard to follow those types. Date command pollutes output, so tweak test.
* | Typo and spelling correctionsJanek Bogucki2016-11-112-3/+3
| |
* | Merge pull request #5303 from xuwei-k/isNaN-boxingJason Zaugg2016-11-111-5/+5
|\ \ | | | | | | avoid boxing
| * | avoid boxingxuwei-k2016-10-281-5/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scala.runtime.Rich{Double, Float} has `isNaN` and these are value class. Also java.lang.{Double, Float} has `isNaN`. - https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html#isNaN-- - https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html#isNaN-- We can't call `RichDouble#isNaN` because `implicit def double2Double(x: Double): java.lang.Double` is higher priority than `implicit def doubleWrapper(x: Double): RichDouble` ``` $ scala -version Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL $ scala -Xprint:jvm -e "1.0.isNaN" [[syntax trees at end of jvm]] // scalacmd616162202928036892.scala package <empty> { object Main extends Object { def main(args: Array[String]): Unit = { new <$anon: Object>(); () }; def <init>(): Main.type = { Main.super.<init>(); () } }; final class anon$1 extends Object { def <init>(): <$anon: Object> = { anon$1.super.<init>(); scala.this.Predef.double2Double(1.0).isNaN(); () } } } ```
* / Regression: Make Future.failed(e).failed turn into a success instead of failureViktor Klang2016-11-081-1/+1
|/
* Replace deprecated conformsLifu Huang2016-10-091-3/+3
| | | Replace deprecated conforms with identity.
* Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-292-6/+6
|
* Lower-case spelling of @deprecated messagesSimon Ochsenreither2016-05-286-26/+26
|
* Improvements to scala.concurrent.FutureViktor Klang2016-05-201-58/+101
| | | | | | * Enhanced Scaladocs with groupings and clarifications * traverse now runs the last step like sequence * A few minor non-semantic changes to method implementations
* use Future#foreach instead of onSuccess in example codexuwei-k2016-04-141-2/+2
| | | | | bacause Future#onSuccess is deprecated https://github.com/scala/scala/commit/fa0743c32338f147eaf7a
* General cleanups and less warnings during a Scala buildsoc2016-04-041-5/+3
|
* Merge pull request #5047 from kmizu/resolve-several-warningsAdriaan Moors2016-03-221-4/+4
|\ | | | | Resolve several deprecation warnings
| * Resolve warnings related to SyncVar#setKota Mizushima2016-03-181-4/+4
| | | | | | | | Replace it with SyncVar#put
* | Fix some typos in `spec` documents and comments.Dongjoon Hyun2016-03-151-1/+1
|/
* Merge pull request #4894 from mmynsted/2.12.xJason Zaugg2016-02-121-1/+11
|\ | | | | Provide simpler commented example for Future.map
| * Making commented example simpler for mapMark Mynsted2016-01-191-1/+11
| | | | | | | | | | | | | | | | Adding connection between map and for As described by SethTisue. Removing parentheses Fixing scaladoc
* | Merge commit 'cc6fea6' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-041-0/+2
|\ \ | | | | | | | | | | | | | | | Conflicts: build.sbt scripts/jobs/integrate/bootstrap
| * | Link 'Future' scaladoc to 'Futures and Promises'Arnout Engelen2016-01-251-0/+2
| | |
* | | Merge commit 'bf599bc' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-031-2/+2
|\| | | |/ |/| | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala src/compiler/scala/tools/nsc/transform/Constructors.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery.layout.js
| * Fix Scaladoc overloaded method link to Duration companion objectJanek Bogucki2016-01-041-2/+2
| | | | | | | | | | | | The links were being skipped with a warning before this commit. The key change was to remove the result type and add an asterisk.
* | Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-184-17/+13
| | | | | | | | | | | | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* | Merge pull request #4825 from soc/topic/drop-threadpool-fallbackJason Zaugg2015-11-131-31/+12
|\ \ | | | | | | Remove ThreadPoolExecutor fallback in ExecutionContextImpl
| * | Remove ThreadPoolExecutor fallback in ExecutionContextImplSimon Ochsenreither2015-10-281-31/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method createDefaultExecutorService had a fallback if the creation of a ForkJoinPool didn't succeed. This was necessary, because Scala shipped its own version of FJP, and the dependency on sun.misc.Unsafe (which is not an "offical" official API) made portability slightly questionable. Now that we can assume that FJP is supplied by the JDK, this concern goes away.
* | | Merge pull request #4834 from som-snytt/issue/9545-docJason Zaugg2015-11-131-23/+20
|\ \ \ | | | | | | | | SI-9545 SyncVar doc and deboxing
| * | | SI-9545 De-option SyncVarSom Snytt2015-11-011-19/+17
| | | | | | | | | | | | | | | | | | | | | | | | Don't store the wrapped value double-wrapped in Option. Also burnish some more docs.
| * | | SI-9545 Correct doc for SyncVar.get(t)Som Snytt2015-11-011-4/+3
| |/ / | | | | | | | | | It used to have javish semantics, but now is what it is.
* / / SI-7566 Remove some private, deprecated remnants from scala-actorsSimon Ochsenreither2015-10-274-151/+0
|/ /
* | Merge commit 'bb3ded3' into merge-2.11-to-2.12-oct-5Lukas Rytz2015-10-051-1/+1
|\|
| * Use InternalCallbackExecutor in Future.sequencePaul Draper2015-10-021-1/+1
| | | | | | | | | | Previously _.result() was invoked in the "real" ExecutionContext, but this is an unnecessary use of the context.
| * Update Java and Sun URLs to replacement Java and Oracle URLsJanek Bogucki2015-09-021-1/+1
| | | | | | | | | | | | | | For each URL - Where it redirected the target of the redirection was used - Where is no longer existed a replacement was selected
| * SI-8362: AbstractPromise extends AtomicReferenceMariot Chauvin2015-07-291-30/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid `sun.misc.Unsafe`, which is not supported on Google App Engine. Deprecate `AbstractPromise` --> extend `j.u.c.atomic.AtomicReference` directly. `AtomicReference.compareAndSet()` should also provide better performance on HotSpot, which compiles it down to the machine's CAS instruction. The binary incompatible change is ok because it's in an internal package. I can't think of any real issue with adding a superclass (which contributes only final methods) to a class in an implementation package (as long as those methods were not introduced in any illicit subclasses of said class). Instead of changing `DefaultPromise`'s super class, let's be more conservative, and do it closest to the source. This is both clearer and more focussed, leaving those subclasses of AbstractPromise we never heard of unaffected. Genesis of the commit: since the work on `Future` performance, `AbstractPromise` is using `Unsafe`, breaking the ability for `Future` to be executed on GAE. At that time, viktorklang suggested to implement a fallback in case `Unsafe` is not available. carey proposed an implementation, and mchv submitted a patch, which was refined by adriaanm.
* | Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-09-081-1/+1
| | | | | | | | | | | | | | | | only trivial merge conflicts here. not dealing with PR #4333 in this merge because there is a substantial conflict there -- so that's why I stopped at 63daba33ae99471175e9d7b20792324615f5999b for now
* | SI-9381 remove last vestiges of sun.misc.UnsafeSeth Tisue2015-08-271-38/+0
| | | | | | | | now that Akka 2.4 doesn't need it anymore
* | Unfinalize the class DefaultPromiseJason Zaugg2015-08-131-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was non-final in Scala 2.11.x, and made final as part of fa0743c32. Removing the final modifier seems like the cleanest way to enable conversions like `javaFuture.toScala.toJava` to return the original `javaFuture` in scala-java8-compat. I have made the methods defined in this class final as an alternative lockdown. Discussion, Motivation: https://github.com/scala/scala-java8-compat/pull/46 https://github.com/scala/scala-java8-compat/pull/50
* | Remove our fork of forkjoin. Java 8 bundles it.Adriaan Moors2015-07-153-2/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide deprecated compatibility stubs for the types and static members, which forward as follows: ``` scala.concurrent.forkjoin.ForkJoinPool => java.util.concurrent.ForkJoinPool scala.concurrent.forkjoin.ForkJoinTask => java.util.concurrent.ForkJoinTask scala.concurrent.forkjoin.ForkJoinWorkerThread => java.util.concurrent.ForkJoinWorkerThread scala.concurrent.forkjoin.LinkedTransferQueue => java.util.concurrent.LinkedTransferQueue scala.concurrent.forkjoin.RecursiveAction => java.util.concurrent.RecursiveAction scala.concurrent.forkjoin.RecursiveTask => java.util.concurrent.RecursiveTask scala.concurrent.forkjoin.ThreadLocalRandom => java.util.concurrent.ThreadLocalRandom ``` To prepare for Java 9, the Scala library does not itself use `sun.misc.Unsafe`. However, for now, it provide a convenience accessor for it via `scala.concurrent.util.Unsafe`. This (deprecated) class will be removed as soon as the eco-system drops its use (akka-actor, I'm looking at you).
* | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-05-012-2/+5
|\| | | | | | | merge/2.11.x-to-2.12.x-20150501
| * Merge pull request #4416 from Ichoran/issue/9197Adriaan Moors2015-04-221-1/+4
| |\ | | | | | | SI-9197 Duration.Inf not a singleton when deserialized
| | * SI-9197 Duration.Inf not a singleton when deserializedRex Kerr2015-03-311-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Made `Duration.Undefined`, `.Inf`, and `.MinusInf` all give back the singleton instance instead of creating a new copy by overriding readResolve. This override can be (and is) private, which at least on Sun's JDK8 doesn't mess with the auto-generated SerialVersionUIDs. Thus, the patch should make things strictly better: if you're on 2.11.7+ on JVMs which pick the same SerialVersionUIDs, you can recover singletons. Everywhere else you were already in trouble anyway.
| * | Fix many typosMichał Pociecha2015-04-211-1/+1
| |/ | | | | | | | | This commit corrects many typos found in scaladocs and comments. There's also fixed the name of a private method in ICodeCheckers.
* | Merge commit 'fcc20fe' into merge/2.11-to-2.12-apr-1Lukas Rytz2015-04-012-6/+75
|\|
| * Merge commit 'ad845ff' into merge/2.10.x-to-2.11.x-20150224Jason Zaugg2015-02-241-4/+1
| |\ | | | | | | | | | | | | | | | Conflicts: src/library/scala/concurrent/Promise.scala test/files/jvm/future-spec/PromiseTests.scala
| | * SI-8689 Avoid internal error in Promise after sequence of completionsViktor Klang2015-02-041-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling `completeWith` when the `DefaultPromise` is already completed, leads to callbacks not being properly executed. This happened because `Future.InternalCallbackExecutor` extends `BatchingExecutor`[1] which assumes `unbatchedExecute` to be async, when in this case it is sync, and if there is an exception thrown by executing the batch, it creates a new batch with the remaining items from the current batch and submits that to `unbatchedExecute` and then rethrows, but if you have a sync `unbatchedExecute`, it will fail since it is not reentrant, as witnessed by the failed `require` as reported in this issue. This commit avoids problem by delegating `completeWith` to `tryComplete`, which has the effect of using `onComplete` + `tryComplete` i.s.o. `complete`, which means that when it fails (because of a benign race condition between completers) it won't throw an exception. It has been tested by the minimized reproducer. [1] Actually, in the 2.10.x branch where this patch is starting out, "The BatchingExecutor trait had to be inlined into InternalCallbackExecutor for binary compatibility.". This comment will be more literally correct in the context of 2.11.x and beyond
| | * More clear implicitNotFound error for ExecutionContextJames Ward2014-01-081-1/+1
| | |
| * | Merge pull request #4245 from dickwall/doc/scaladoc-concurrent-packageLukas Rytz2015-02-031-0/+74
| |\ \ | | | | | | | | Document concurrent package object
| | * | Added package scaladoc for the concurrent package.dickwall2015-01-121-0/+74
| | | |