Question: I've just recently started using hibernate and so I apologize if this is a stupid question.

I want to package some of my code into a module which different applications can then utilize.
For example, a package that handles sending SMS messages.
This package does some database work to get basic config data and then might do some transaction logging.
This will then be added to applications requiring SMS functionality.
The package would therefore require the calling application to contain the specific config and logging tables required by the package.

My problem is that in order to write the hibernate methods that get the config and do the logging it needs to know of the hibernate specific DOA objects. The problem is these objects are only generated when we create the specific application database mapping.

Answer: 
It depends on what you are wanting to do. A simple sleep will suffice for your trivial example of waiting 10 sec between "Hello"s since you might as well suspend your current thread until your time is up.

Things get more complicated if your thread is actually doing something while you are waiting. If you are responding to incoming connections, you will already be using `select` in such a case a timeout to your `select` statement makes the most sense for your housekeeping.

If you are processing stuff in a tight loop, you might regularly poll a start time to see if your 10 seconds are up.

`alarm` with an appropriate signal handler will work as well but there are severe limits to what you can do in a signal handler. Most of the time, it involved setting a flag that will need to be polled every so often.

In a nutshell, it comes down to how your thread is processing events.
sleep() is the easiest way. usleep() exists on some variants. If you want sub-second accuracy, select(NULL, NULL, NULL &timeout) is the most portable, unless you write your own OS-specific routines. The select() method has the advantage that timeout is updated to reflect the amount of time remaining if the call was interrupted by a signal. You can resume the wait if needed.

Really, all of the methods are equivalent; the OS stops scheduling the thread for the timeout period. 

The SIGALARM method suggested by Blagovestus is (somewhat) unportable, even though it should work on Linux.