Only set multiprocessing to spawn for MacOS.
This commit is contained in:
parent
6560cf52b6
commit
d1b474962d
1 changed files with 6 additions and 3 deletions
|
@ -5,7 +5,7 @@ import json
|
|||
import sounddevice as sd
|
||||
import setproctitle
|
||||
import logging
|
||||
import sys
|
||||
from helpers.os_environment import isMacOS
|
||||
|
||||
setproctitle.setproctitle("BAPSicle - Server")
|
||||
|
||||
|
@ -30,6 +30,7 @@ channel_p = []
|
|||
|
||||
stopping = False
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(e):
|
||||
data = {
|
||||
|
@ -154,6 +155,7 @@ def status(channel):
|
|||
|
||||
return response
|
||||
|
||||
|
||||
@app.route("/quit")
|
||||
def quit():
|
||||
stopServer()
|
||||
|
@ -173,7 +175,8 @@ def send_static(path):
|
|||
|
||||
|
||||
def startServer():
|
||||
multiprocessing.set_start_method("spawn", True)
|
||||
if isMacOS():
|
||||
multiprocessing.set_start_method("spawn", True)
|
||||
for channel in range(3):
|
||||
|
||||
channel_to_q.append(multiprocessing.Queue())
|
||||
|
@ -200,7 +203,7 @@ def stopServer():
|
|||
player.join()
|
||||
except:
|
||||
pass
|
||||
print ("Stopped all players.")
|
||||
print("Stopped all players.")
|
||||
global stopping
|
||||
if stopping == False:
|
||||
stopping = True
|
||||
|
|
Loading…
Reference in a new issue