github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

evanlong / evan-public-development

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: acfa9ee

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

my public development respository — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Merge branch 'master' of git@github.com:evanlong/evan-public-development 
longx223 (author)
Mon Apr 06 22:45:04 -0700 2009
commit  acfa9ee64470f477bc1b715fb361c4f695d37788
tree    fe923fb460b70dbfad2b3e93e3ca168a26f84ce5
parent  694125fad76b76749e63427613fff14d1980004f parent  1ea66845835e8cd5690e92c5aed5b3434b323fe0
evan-public-development / fokker / fokker.py fokker/fokker.py
100644 64 lines (47 sloc) 1.26 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#Evan Long
#Copyright 2009
 
from __future__ import with_statement
import threading
import time
 
prop = {
    'rpm':8
}
 
gun = {
    'rounds':20,
    'rate':1,
    'tracer_rate':3
}
 
rounds_lock = threading.Lock()
gun_can_fire = threading.Event()
 
def runprop():
    while True:
        with rounds_lock:
            if gun['rounds'] <= 0:
                break
        
        gun_can_fire.clear()
        
        print 'Prop in gun zone'
        time.sleep(prop['rpm']/4); #time in zone
        print 'prop out of gun zone'
 
        gun_can_fire.set()
 
        time.sleep(prop['rpm']/2); #time to spin back to zone
 
    print 'prop done'
 
def rungun():
    while True:
        gun_can_fire.wait()
        with rounds_lock:
            gun['rounds'] -= 1
            if gun['rounds'] % gun['tracer_rate'] == 0:
                print 'tracer fired'
            if gun['rounds'] <= 0:
                break
            print 'rounds %d' % gun['rounds']
        time.sleep(gun['rate'])
    print 'gun done'
 
if __name__ == '__main__':
    prop_thread = threading.Thread(target=runprop)
    gun_thread = threading.Thread(target=rungun)
 
    gun_can_fire.clear()
 
    prop_thread.start()
    gun_thread.start()
 
    prop_thread.join()
    gun_thread.join()
    
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server