Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5030

General • Proper way to terminate a dual core use ?

$
0
0
Hello, I'm starting to delve into using both cores. I'm currently using micropython with rshell (latest 0.0.36) although I can use C as well and will later on.

So I have a very simple example of one core calling the other, waiting for it to do its thing and terminate, and then to call it again after a short delay, each core printing some numbers at the repl console, so on so forth without stop. I execute the python file in repl using :

>>> exec(open('core0LaunchesCore1-Class.py').read())

Now when I want to terminate this I use Ctrl-C with repl outputting this :

Code:

Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "<string>", line 68, in <module>  File "<string>", line 32, in core0_threadKeyboardInterrupt: 
Here's my question. When I immediately try to start it again it reports the following :

Code:

>>> exec(open('core0LaunchesCore1-Class.py').read())Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "<string>", line 67, in <module>OSError: core1 in use
Which makes sense. After all, who told core1 to stop if the Ctrl-C happens before core1 self-terminates ?

Is there a clean way to terminate ever-running software that uses both cores ?

Thanks.

Statistics: Posted by mevla — Tue Jan 21, 2025 4:52 pm — Replies 0 — Views 38



Viewing all articles
Browse latest Browse all 5030

Trending Articles