Skip to content

Use a different startmethod for curses comaptibility #9

@AiyionPrime

Description

@AiyionPrime

Currently this project uses the multitprocessing module and makes use of Process(), which are started using start().

self.p = Process(target=self.pwm_process, args=(self.gpio, self.sleep_high, self.sleep_low, self.precision), name='pwm_process')
self.p.start()

This does invoke one of the three different startmethods of multiprocessing implicitely.
https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

Apparently one of the forking kind.
This leads to an incompatibility with curses, as screen properties are reset, when a (forked) child process exits.
Which means, everytime a PWM stop()s, curses screen does all sorts of stuff.

This project would not invoke such unwanted side effects, if started processes where spawned instead of forked.
In documentation a few lines below the above reference https://docs.python.org/3/library/multiprocessing.html#multiprocessing.set_start_method is documented.

@Leapo Would it be possible to use it instead of the implicit behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions