This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: java.util.TimerTask
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Erik Poupaert <erik dot poupaert at chello dot be>
- Cc: Andrew Haley <aph at redhat dot com>, <java at gcc dot gnu dot org>
- Date: Thu, 19 Jun 2003 10:46:32 -0400 (EDT)
- Subject: 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