No project description provided
Project description
rchp
Run the following command to install rchp:
pip install rchp
No dependencies need to be installed.
rchp supports Python 3.10+
The usage of its main function parallel is as follows:
import rchp
import time
def task():
for i in range(20):
print(f"Task: {i}")
rchp.parallel(func=task, worker=2, wait=False)
for i in range(10):
print(f"Main: {i*i}")
time.sleep(0.5)
func is the function to be parallelized.
worker is the number of threads.
wait indicates whether the main thread waits for the threads to complete their tasks.
- The first parameter does not accept functions with arguments.
- If an exception is thrown within the function, loss of information may occur or it may manifest as
process terminated with exit code -1073740791 (0xC0000409). Please ensure there are no errors in the function.
Additionally, in the update to version 0.2.0, the CPRVER function has been added to retrieve version information of the CPR library. An example is provided below:
import rchp
print(rchp.CPRVER())