mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-25 16:06:32 +01:00
libraries can now work threaded if they wish (see http_requests). This means that multiple functions provided by one library can run at the same time (using thread(), see http.mers) and actually do the work they need to do simultaneously.
This commit is contained in:
17
http.mers
Normal file
17
http.mers
Normal file
@@ -0,0 +1,17 @@
|
||||
lib mers_libs/http_requests
|
||||
|
||||
t = thread(() {
|
||||
// because this downloads for so long, the println() will appear after the other one.
|
||||
http_get("https:\//raw.githubusercontent.com/dwyl/english-words/master/words.txt").assume_no_enum()
|
||||
println("got words from word list!")
|
||||
})
|
||||
|
||||
sleep(0.5)
|
||||
|
||||
// this will finish before the thread does.
|
||||
http_get("https:\//github.com/").assume_no_enum()
|
||||
println("got github start page as html")
|
||||
|
||||
// t.await()
|
||||
|
||||
http_get("not a url").debug()
|
||||
Reference in New Issue
Block a user