Skip to content

sv1jsb/pingpong-threads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

pingpong-threads

Python threading project. Play pingpong with threads.

This is a python port of Dr. Douglas C. Schmidt's example project Pingpong. It's an example of using and synchronizing threads in java, as part of coursera's POSA-002 MOOC.

Python port specifics

Threads

This python port uses Semaphores, RLocks and Conditions to synchronize threads. Also an implementation of java's CountDownLatch is used to enforce a barrier synchronization of the two threads.

Pattterns

As the original project, the python port uses the Template pattern to instantiate concrete ping and pong threads, and the Strategy pattern to provide environment specific output and control. The Singleton pattern is used for providing only one object for a Strategy class.

Use

All code is in pingpong directory. The program is designed so it can be run by command prompt or be imported as a module. In both uses, if no arguments are given it will run with the default values.

Run:

python pp.py -h

at the toplevel directory of this repository for help on command arguments.

Have fun

Clone and experiment. After all this is an educational project.

About

Python threading project. Play ping pong with threads.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages