https://kotlinlang.org logo
#coroutines
Title
# coroutines
g

GarouDan

04/11/2019, 11:24 AM
Hi guys, let me ask you a simple question. When using co-routines, will we be using all cpus available always?
🚫 4
l

louiscad

04/11/2019, 11:37 AM
Maybe girls could reply too, all folks in fact. Read the documentation of
Dispatchers
and its members (Main, Default and IO), that will answer your question.
👍 5
👎 3
t

tseisel

04/11/2019, 11:38 AM
It depends on the
CoroutineDispatcher
you're using: -
Dispatchers.Default
uses a pool of threads having at most 1 thread per CPU core -
<http://Dispatchers.IO|Dispatchers.IO>
uses up to 64 threads -
Dispatchers.Main
has only one thread - When not specifying a dispatcher, it inherits the parent scope's I Hope I correctly understood the question !
g

GarouDan

04/11/2019, 12:03 PM
@louiscad, about
guys
, I’ve asked my personal English teach that is from England and he said to me that
guys
is completely generic. Not referring to males. In his words
Copy code
I disagree with him. Guys is totally generic. You can even call a group of only women, "guys"
7
😱 1
🤔 1
@tseisel, interesting, I didn’t know that. I’ll be reading the Dispatchers section as @louiscad said, but have we an option that we could use as many threads as needed in all cpu cores if we want?
l

louiscad

04/11/2019, 12:50 PM
@GarouDan I think that what best suits your needs is
Dispatchers.Default
.
@GarouDan About "guys" and your teacher, did you ever saw the following sentence? "She is a nice guy" Just search on the web and in dictionaries for that 😉
💩 3
👌 1
👍 1
s

Seri

04/11/2019, 3:01 PM
using
guys
is grammatically correct, but it’s also androcentric as hell https://en.wikipedia.org/wiki/Androcentrism#Generic_male_language
4
2 Views