threading seems to work with the minimum threading module

This commit is contained in:
Balthasar Reuter
2015-06-20 00:46:28 +02:00
parent 0f25f8de88
commit a6ceb2b3cc

View File

@@ -7,7 +7,7 @@ import os
from datetime import datetime from datetime import datetime
from time import sleep from time import sleep
import subprocess import subprocess
from threading import Thread import thread
##################### #####################
### Configuration ### ### Configuration ###
@@ -92,15 +92,14 @@ class Slideshow:
def routine_command(cmd, interval): def routine_command(cmd, interval):
while True: while True:
print("Running routine") print("Running routine")
#output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
#print("Output is " + output) print("Output is " + output)
sleep(interval) sleep(interval)
def main(): def main():
show = Slideshow(display_size, display_time, directory, True) thread.start_new_thread(routine_command, ("rsync -rt " + directory + "/ slideshow/", 3))
sync = Thread(target=routine_command, args=("/bin/echo 'Routine executed'", 5) )
#sync.run() show = Slideshow(display_size, display_time, directory, True)
show.run() show.run()
sync.join() sync.join()