newbie question

C

Craig Rafferty

This has probably got a simple answer but I don't know what it is, any help
would be appreciated.

I am trying to create a thread to watch the value of an integer, there will
be set bounds that this integer must be in(ie >0 and < 50). I require that
when the value of the integer goes outside of these bounds, the calling
thread, in this case the main thread, will be notified.

To explain a little further, I am doing a project where I will use java to
simulate some sort of controller. My controller will allow taps to be turned
on to fill a tub and drainage to be activated. I had intended to model a
depth sensor using a thread to continually provide information on the water
depth, allowing the main program to control other things, when the maximum
depth is reached, the thread should interrupt the main program telling it.
This would save the main program from continually polling the depth sensor.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top