Sep. 12th, 2013

juan_gandhi: (VP)
(10x [livejournal.com profile] sassa_nf)

 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
  def spendNotMoreThan[T](time: Duration, extraTimePercent:Int = 1) = new {
    def on(op: => Result[T]): Result[T] = {
      import LockSupport._
      var res:Result[T] = Empty
      val millis = time.toMillis
      val finalDeadline = System.currentTimeMillis + millis * (100 + extraTimePercent) / 100 + 1
      val done = new AtomicBoolean(false)
      val worker = new Thread {
        override def run {
          try {
            res = op
            done.set(true)
          } catch {case ie: InterruptedException => }
        }
      }
      worker.setPriority(1)
      worker.start
      worker.join(time.toMillis)
      if (worker.isAlive) {
        worker.interrupt
        parkUntil(finalDeadline)
      }
      if (worker.isAlive) worker.stop
      if (done.get) res else Result.error(s"Timeout after $time")
    }
  }


Read more... )
juan_gandhi: (VP)
Я представляю себе, как только если Scala Навальный станет мейнстримом, у него тоже заведутся свои потупчики, и олигархи будут финансировать какую-нибудь тоже Канатчикову Дачу, где за 85 р поциенты будут гнать компромат на Путина и его камарилью.

Было бы неплохо, в сущности - получилось бы прям как у нас в США.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

August 2025

S M T W T F S
      12
3456789
10 11 12 13141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 19th, 2025 08:04 am
Powered by Dreamwidth Studios