Ruby Threading

Thread.new{}
2.times do |i|    Thread.new {        10000000.times do |t|        t + 1        end        ending = Time.now        elapsed = ending - starting        puts ("#{i} End:" + elapsed.to_s)     }endending = Time.nowelapsed = ending - startingputs ("Main End:" + elapsed.to_s)
x = Thread.new{}
x.join

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

LINUX FILE SYSTEM

How does ServiceNow Admin deal with ServiceNow Problem Management?

Strategies for Effective Database Synchronization

CSS 3 Grid

9 Habits of Highly Successful Software Engineers

Script to run Selenium and Headless Chrome on AWS Lambda with SAM

How to Create a Django Rest Framework-GIS on Ubuntu 16.04 Server (Part 2)

Bad Search Can Break a Good App — Real World Example

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aidanmc

Aidanmc

More from Medium

Writing, Accessing, and Modifying Nested APIs with Ruby & Sinatra

Understanding the MVC with Rails

Everything is “Enumerable” in Ruby

CURD actions with Ruby Sinatra