Skip to content

Instantly share code, notes, and snippets.

View djspiewak's full-sized avatar

Daniel Spiewak djspiewak

View GitHub Profile
package me.katze
import cats.effect.*
import cats.effect.std.Dispatcher
import org.lwjgl.glfw.*
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.opengl.GL11.*
import org.lwjgl.opengl.{GL, GLUtil}
import org.lwjgl.system.MemoryStack.stackPush
import org.lwjgl.system.MemoryUtil.NULL
package me.katze
import cats.effect.*
import cats.effect.std.Dispatcher
import org.lwjgl.glfw.*
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.opengl.GL11.*
import org.lwjgl.opengl.{GL, GLUtil}
import org.lwjgl.system.MemoryStack.stackPush
import org.lwjgl.system.MemoryUtil.NULL
* thread #13
* frame #0: 0x0000000105004c58 cats-effect-tests-test`Synchronizer_acquire at Synchronizer.c:300:9
frame #1: 0x00000001050033b4 cats-effect-tests-test`Heap_Collect(heap=0x00000001085a51a0, stack=0x00000001085a5238) at Heap.c:170:10
frame #2: 0x0000000105001148 cats-effect-tests-test`Allocator_allocSlow(allocator=0x000000014c604e70, heap=0x00000001085a51a0, size=48) at Allocator.c:225:9
frame #3: 0x000000010500129c cats-effect-tests-test`Allocator_Alloc(heap=0x00000001085a51a0, size=48) at Allocator.c:251:16
frame #4: 0x0000000105004548 cats-effect-tests-test`scalanative_GC_alloc_small(info=0x00000001085a17c0, size=48) at ImmixGC.c:56:31
frame #5: 0x0000000104fa0d48 cats-effect-tests-test`M33scala.collection.immutable.Range$D5applyiiL42scala.collection.immutable.Range$ExclusiveEO(this=<unavailable>, start=0, end=0) at Range.scala:568:54
frame #6: 0x000000010474caec cats-effect-tests-test`M22scala.runtime.RichInt$D15until$extensioniiL32scala.collection.immutable.RangeEO(th
* thread #1: tid = 0x26b505f, 0x000000018a83e358 libsystem_kernel.dylib`__recvfrom + 8, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
thread #2: tid = 0x26b5063, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #3: tid = 0x26b5064, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #4: tid = 0x26b50b2, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #5: tid = 0x26b50b3, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #6: tid = 0x26b50b4, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #7: tid = 0x26b50b5, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #8: tid = 0x26b50b6, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
thread #9: tid = 0x26b50b7, 0x000000018a845bdc libsystem_kernel.dylib`kevent64 + 8
thread #10: tid = 0x26b50b8, 0x000000018a83d5cc libsystem_kernel.dylib`__psynch_cvwait + 8
"core PC state machine" should {
import cats.effect.kernel.{GenConcurrent, Outcome}
import cats.effect.kernel.implicits._
import cats.syntax.all._
type F[A] = PureConc[Int, A]
val F = GenConcurrent[F]
"run finalizers when canceling never" in {
val t = for {
/*
* There are two fundamental modes here: sequential and parallel. There is very little overlap
* in semantics between the two apart from the submission side. The whole thing is split up into
* a submission queue with impure enqueue and cancel functions which is drained by the `Worker` and an
* internal execution protocol which also involves a queue. The `Worker` encapsulates all of the
* race conditions and negotiations with impure code, while the `Executor` manages running the
* tasks with appropriate semantics. In parallel mode, we shard the `Worker`s according to the
* number of CPUs and select a random queue (in impure code) as a target. This reduces contention
* at the cost of ordering, which is not guaranteed in parallel mode. With sequential mode, there
* is only a single worker.
@State(Scope.Thread)
class FilesBenchmark {
private[this] var target: Path = _
@Setup
def setup() = {
val file = File.createTempFile("fs2-benchmarks-", "-walk")
file.delete()
file.mkdir()
[info] DispatcherSpec
[info] sequential dispatcher should
[info] await = true
[info] + reject new tasks while shutting down
[info] await = false
[info] + reject new tasks while shutting down
[info] parallel dispatcher should
[info] await = true
[info] + reject new tasks while shutting down
[info] await = false
[43/1037] shared[2.12.17].compile
[info] compiling 10 Scala sources and 1 Java source to /Users/daniel/Development/Scala/bloop/out/shared/2.12.17/compile.dest/classes ...
[info] done compiling
[77/1037] backend[2.12.17].compile
[info] compiling 58 Scala sources and 1 Java source to /Users/daniel/Development/Scala/bloop/out/backend/2.12.17/compile.dest/classes ...
[warn] one deprecation
[warn] one deprecation (since 3.0.0-RC2)
[warn] two deprecations in total; re-run with -deprecation for details
[warn] one feature warning; re-run with -feature for details
[warn] four warnings found
package sillio
import cats.syntax.all._
import scala.annotation.tailrec
import scala.concurrent.ExecutionContext
import scala.util.control.NonFatal
import java.util.concurrent.atomic.{AtomicBoolean, AtomicReference}