Getting started with concurrency
Before we deep dive into the programming world of concurrency, we ought to know a couple of basics about time
, a standard library in V, and the thread
type. In this section, I will provide a very brief introduction to the time
module and the thread
type. Understanding these concepts will be helpful as we continue this chapter.
Understanding the time module
V ships along with it a classy suite of handy libraries and time
is among them. I will be using the time
module to mimic long-running activities in functions that run concurrently. To use the time
module, you need to import it, as follows:
import time
The time
module in V has a vast number of functionalities, including telling the current time on the system using the time.now()
expression. If we are just interested in the hours, minutes, and seconds part of the time at the time of execution, you can write the corresponding expression as time.now().hhmmss()
. These are a few functions among...