This release is a pre-release and may not be stable for production use.
messageboard
A synchronization primitive containing a value, allowing threads to concurrently set the value and peek the most recently set value.
Features
- Thread-safe.
.set(value)sets the value..peek()peeks the most recently set value. If no value is set yet,.peek()blocks until a value is set.
Usage
from __future__ import print_function
import random
random.seed(42)
import threading
import time
from messageboard import MessageBoard
def writer(message_board):
for i in range(10):
message_board.set(i)
print('Written', i)
time.sleep(1)
def reader(sticky_value):
for i in range(10):
if random.random() > 0.5:
sticky_value.peek()
print('Peeked', i)
time.sleep(1)
board = MessageBoard()
writer_thread = threading.Thread(target=writer, args=(board,))
writer_thread.daemon = True
reader_thread = threading.Thread(target=reader, args=(board,))
reader_thread.daemon = True
writer_thread.start()
reader_thread.start()
writer_thread.join()
reader_thread.join()
This produces the following output:
Written 0
Peeked 0
Written 1
Written 2
Written 3
Written 4
Peeked 4
Written 5
Peeked 5
Written 6
Peeked 6
Written 7
Written 8
Written 9
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Metadata
Release files for messageboard 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| messageboard-0.1.0a0.tar.gz | 2.8 kB | Without provenance | Details for messageboard-0.1.0a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| messageboard-0.1.0a0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for messageboard-0.1.0a0-py2.py3-none-any.whl |
Total release size: 6.0 kB
Release files / messageboard-0.1.0a0.tar.gz
| Download URL | messageboard-0.1.0a0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aba86f283d86e7afab984f85a59eedb233820309f3ce08582244bca24021693a
|
|
BLAKE2b-256 checksum How to use checksums |
a50cd712dbaa7b1b15752f7aa2f238cc3654cf5d02bc2f7ab468849f1b870979
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / messageboard-0.1.0a0-py2.py3-none-any.whl
| Download URL | messageboard-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4b259a7fcbde00f978e95c7446e49d07396ea5ef993aea868575e3fe11db7872
|
|
BLAKE2b-256 checksum How to use checksums |
2c8c4d2a0f0ab71ce0bc15f96038b9f7571e409fded01e519644762e1d5c3732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for messageboard 0.1.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.