Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #20990

Re: single instance

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: single instance
Date 2013-01-05 17:43 +0000
Organization UK Free Software Network
Message-ID <kc9onj$bp9$1@localhost.localdomain> (permalink)
References <iah6e8hb9ssp4q46ukh3scb81bjb9fdq1k@4ax.com> <sm7be8dvh8ulkncsrh3s5a1f0a0h3d6ah3@4ax.com> <ml38v8maw1s1$.1gx93ez99j3rq$.dlg@40tude.net> <kc4rpu$4at$1@localhost.localdomain> <PNidnQgKw5vavHXNnZ2dnUVZ8t-dnZ2d@bt.com>

Show all headers | View raw


On Sat, 05 Jan 2013 12:48:41 +0000, Chris Uppal wrote:

> There may be something added to modern Linux (or whatever) that makes it
> easier to create shared temporary files (not the requirement here, of
> course).  But there's nothing in "classic" *NIX (say from around the
> time of SysV).
>
Correct: test C code written and checked to prove your point. The Stratus 
VOS OS left the file in place: you could see it from list_directory after 
it had been deleted, but Linux doesn't do that.

However, the automatic cleanup is easy enough to manage from C via the 
atexit() function, which is very to use since you just call atexit() near 
the start of the main() function: once atexit() has registered your exit 
action(s) you get on with whatever the program is meant to do in the 
knowledge that these actions will happen regardless of how the program 
exits (power failures and system crashes excluded). 

This works for Linux and all Unices since SVR4. atexit() is documented in 
the O'Reilly Lion book. The current kernel 3.6 Linux manpage says 
atexit() conforms to SVR4, 4.3BSD, C89, C99 and POSIX.1-2001.

It looks as though the nearest we can come to this in Java is via 
try...finally blocks.

However, I'm wondering if the finally block would always execute, e.g. if 
the try...finally block is in the main() method of a program that exits 
leaving thread(s) running to do the work, does the finally block still 
get still run when the last thread(s) terminates?  I had a fairly cursory 
look at JLS 14.20.1 but it wasn't clear on this point.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-01 12:23 -0800
  Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-01 16:40 -0500
    Re: single instance Robert Tomsick <robert+usenet@tomsick.net> - 2013-01-03 01:20 -0500
  Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-03 00:55 -0800
    Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-03 19:31 -0800
      Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-03 19:49 -0800
      Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-03 19:56 -0800
        Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-04 12:18 -0500
          Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-04 10:22 -0800
            Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-04 13:44 -0500
              Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-04 11:03 -0800
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-04 14:12 -0500
              Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 21:56 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 19:22 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:23 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 20:43 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:47 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 20:51 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:24 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 20:46 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:58 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 21:08 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 21:19 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 21:31 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 21:41 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 22:00 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 22:11 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-07 00:23 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-02-24 18:20 -0500
                Re: single instance Joshua Cranmer <Pidgeot18@verizon.invalid> - 2013-01-06 21:39 -0600
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-07 00:30 -0500
                Re: single instance lipska the kat <lipskathekat@yahoo.co.uk> - 2013-01-07 08:53 +0000
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-02-24 18:18 -0500
                Re: single instance lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-25 08:31 +0000
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-02-24 18:17 -0500
                Re: single instance Lew <lewbloch@gmail.com> - 2013-01-06 17:32 -0800
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 20:47 -0500
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:53 -0500
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 21:01 -0500
          Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 21:59 -0500
            Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 19:34 -0500
              Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:00 -0500
  Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-03 07:12 -0800
    Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-03 09:56 -0800
      Re: single instance Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-03 21:05 +0000
        Re: single instance Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-03 22:08 +0000
        Re: single instance "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-01-05 12:48 +0000
          Re: single instance Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-05 17:43 +0000
            Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-05 09:49 -0800
            Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-05 13:02 -0500
              Re: single instance Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-05 20:29 +0000
                Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-05 19:07 -0800
                Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-06 20:04 -0500
            Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 21:40 -0500
    Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 22:10 -0500
      Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-05 19:49 -0800
        Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 23:09 -0500
          Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 11:00 -0500
            Re: single instance Lew <lewbloch@gmail.com> - 2013-01-06 09:41 -0800
              Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 20:41 -0500
        Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-15 22:51 -0800
          Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-15 23:12 -0800
            Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-15 23:49 -0800
          Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-15 23:16 -0800
            Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-15 23:52 -0800
            Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-16 08:46 -0800
              Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-16 10:46 -0800
                Re: single instance markspace <markspace@nospam.nospam> - 2013-01-16 13:01 -0800
                Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-16 17:10 -0800
          Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-15 23:50 -0800
            Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-16 00:13 -0800
              Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-16 02:48 -0800
                Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-16 07:28 -0800
                Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-16 10:46 -0800
                Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-16 16:53 -0800
                Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-16 23:44 -0800
                Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-17 07:03 -0800
                Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-17 14:25 -0800
                Re: single instance Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-17 16:31 -0800
                Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-17 22:11 -0800
                Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-17 22:36 -0800
              Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-16 13:34 -0500
          Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-16 08:45 -0800
          Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-16 13:29 -0500
            Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-16 17:14 -0800
              Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-16 20:20 -0500
              Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-16 23:52 -0800
              Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-17 01:44 -0800
        Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-18 01:47 -0800
          Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-18 20:50 -0800
            Re: single instance Roedy Green <see_website@mindprod.com.invalid> - 2013-01-20 00:53 -0800
              Re: single instance Lew <lewbloch@gmail.com> - 2013-01-20 12:00 -0800
                Re: single instance Knute Johnson <nospam@knutejohnson.com> - 2013-01-20 13:33 -0800
                Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-02-24 18:12 -0500
              Re: single instance Arne Vajhøj <arne@vajhoej.dk> - 2013-01-20 21:33 -0500
      Re: single instance "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-01-06 13:34 +0000
  Re: single instance Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-04 10:26 -0800
    Re: single instance Twirlip of the Mists <twirlip@killfile.me.now.invalid> - 2013-01-04 14:04 -0500
  Re: single instance stledger@lanl.gov - 2013-01-16 14:51 -0800
    Re: single instance stledger@lanl.gov - 2013-01-16 15:09 -0800

csiph-web