This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java.util.TimerTask


On Thu, 19 Jun 2003, Erik Poupaert wrote:
> The only apparent difference between natObject's and natThread's
> implementations seem to be that natThread wraps its goodies in a mutex?
> I wouldn't like to jumpt to conclusions, but could it be that wrapping
> with a mutex prevents CPU consumption anyhow? Could someone who
> deeply understands this, pitch in?

Mark's answer is the right one.  In the case of Java, the surrounding
synchronized block provides that mutex.

> Another question, if someone knows something about the subject. I'm
> currently using a TimerTask to poll the filesystem. I'd rather,however,
> (if possible) plug in to some kind of filesystem notification system...
> Linux-only would do. I'm perfectly willing to native wrap stuff into
> CNI and delegate this to native methods. Any thoughts?

Discretionary locking might be what you're looking for.  Look at fcntl
and F_SETLKW.  There are similar mechanisms on win32.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]