#ifndef _TEST_APP
#define _TEST_APP


#include "ofMain.h"

class thread1 : public ofThread{

	public:
	
		//--------------------------
		thread1(){
			count = 0;
		}
		
		//--------------------------
		void threadedFunction(){
			
			while( isThreadRunning() != 0 ){
				if( lock() ){
					count++;
					if(count > 50000) count = 0;
					unlock();
					ofSleepMillis(1 * 1000);
				}
			}
		}

		//--------------------------
		void drawCount(){
			
			string str = "Count is ";
		
			if( lock() ){
				str += ofToString(count);
				unlock();
			}else{
				str = "Can't Lock!";
			}						
			ofDrawBitmapString(str, 10, 16);
		}


	int count;
};

class testApp : public ofSimpleApp{
	
	public:
		
		void setup();
		void update();
		void draw();
		
		void keyPressed  (int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased();
		
		ofTrueTypeFont	font;
		float 			synthPosition;
		
		thread1 T1;
};





#endif	
