Skip to content

Commit

Permalink
More info about async and await
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Oct 18, 2023
1 parent b4ba411 commit 903ac9a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/modern_python.md
Original file line number Diff line number Diff line change
Expand Up @@ -1095,17 +1095,27 @@ print(result)

### Souběžnost a paralelismus v Pythonu

* více procesů
* Více procesů
- `multiprocessing`
* více vláken
* Více vláken
- `threading`
* korutiny
* Korutiny
- `asyncio`

---

### `async` a `await`

* Nejenom v Pythonu
- populární i v dalších jazycích
* Typicky pro I/O operace
* Funkce označené `async`
* Čekání na dokončení pomocí `await`

---

### `async` a `await`

* Nekorektní použití `await`

```python
Expand Down Expand Up @@ -1267,6 +1277,8 @@ asyncio.run(main())

### Čtení výsledků přes frontu

* Synchronizace

```python
import asyncio

Expand Down Expand Up @@ -1298,6 +1310,8 @@ asyncio.run(main())

### Producent-konzument

* Běžící asynchronně

```python
import asyncio

Expand Down

0 comments on commit 903ac9a

Please sign in to comment.