Skip to content

Commit dae8dec

Browse files
committed
Fix README.md
1 parent 9c8fa62 commit dae8dec

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

.github/screenshot.png

-293 KB
Loading

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Example: Threads
22

3-
This repository demonstrates **Single-Threading** and **Multi-Threading**.
3+
This repository demonstrates the concepts of **Single-Threading** and **Multi-Threading** based on [DATEX](https://datex.unyt.org) on the example of calculating the digits of PI and creating a [TOR vanity address](https://community.torproject.org/onion-services/advanced/vanity-addresses/).
44

55

66
## Installation
@@ -19,15 +19,15 @@ This repository demonstrates **Single-Threading** and **Multi-Threading**.
1919

2020
## Structure
2121
This diagram outlines the UIX default project structure.
22-
We split our code base in [back-end](https://unyt.org/glossary#back-end), [front-end](https://unyt.org/glossary#front-end), and commons folder.
2322
```
2423
.
2524
└── example-website-screenshot/
2625
├── common/
2726
│ ├── compoments/
2827
│ │ ├── MainPage.scss // Main style declaration
2928
│ │ └── MainPage.tsx // Main component
30-
│ └── Worker.ts // Worker
29+
│ ├── PI-Worker.ts // Worker for PI calculation
30+
│ └── TOR-Worker.ts // Worker for TOR address gen
3131
├── frontend/
3232
│ ├── entrypoint.css // Front-end style declaration
3333
│ └── entrypoint.tsx // Front-end entrypoint
@@ -37,14 +37,13 @@ We split our code base in [back-end](https://unyt.org/glossary#back-end), [front
3737

3838
## Features
3939
* Threading
40+
* Multiple threads
41+
* Disposing of threads
4042

4143
## Preview
4244
<img src=".github/screenshot.png" width="400">
4345

4446

45-
## Explanation
46-
*TODO*
47-
4847
---
4948

5049
<sub>&copy; unyt 2023 • [unyt.org](https://unyt.org)</sub>

common/Worker.ts renamed to common/PI-Worker.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
export function heavyCalculation(x: number, y:number) {
2-
return x + y
3-
}
4-
export const pi = $$('');
51
export function* generateDigitsOfPi() {
62
let q = 1n;
73
let r = 180n;
File renamed without changes.

common/components/MainPage.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
padding-bottom: 30px;
2626
&>input {
2727
flex: 1;
28+
padding: 20px;
2829
border-radius: 10px;
2930
max-width: 300px;
3031
background-color: transparent;

common/components/MainPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class MainPage extends UIX.BaseComponent {
2929
return;
3030
parent.classList.add("hidden");
3131

32-
const threads = await spawnThreads<typeof import('../TOR.ts')>(new Path('../TOR.ts'), 10);
32+
const threads = await spawnThreads<typeof import('../TOR-Worker.ts')>(new Path('../TOR-Worker.ts'), 10);
3333
const calculations = threads.map(thread => thread.generateVanityAddress(this.torAddress.value));
3434
const result = await Promise.any(calculations);
3535
console.log("Found address", result);
@@ -49,7 +49,7 @@ export class MainPage extends UIX.BaseComponent {
4949
return;
5050
parent.classList.add("hidden");
5151

52-
const thread = await spawnThread<typeof import('../Worker.ts')>(new Path('../Worker.ts'));
52+
const thread = await spawnThread<typeof import('../PI-Worker.ts')>(new Path('../PI-Worker.ts'));
5353
const pi = await thread.calculatePI(+this.inputPiDigits.value || 10);
5454
parent.querySelector("section")!.prepend(<span>{pi}</span>)
5555
parent.classList.remove("hidden");

0 commit comments

Comments
 (0)