Commit d8892c4f authored by Christian Wander's avatar Christian Wander
Browse files

making naive threading work

parent da9ea048
from pixelframe import app
from flask import render_template
import pixelframe.threadfun as t
@app.route('/')
def main_page():
......@@ -10,3 +11,8 @@ def main_page():
@app.route('/hello')
def hello_method():
return render_template('hello.html', name="foo")
@app.route('/threadfun')
def threadfun():
t.doit()
return "Started work."
import threading
import time
def doit():
print(f'>> Starting a thread ...')
x = threading.Thread(target=threaded_function)
x.start()
print(f'>> Thread started.')
def threaded_function():
print(f'>> Doing some work within thread ...')
time.sleep(2)
print(f'>> Finished work within thread!')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment