Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"It is easier to fight for principles than to live up to them." -- Alfred Adler


devel / comp.lang.fortran / Is there a way to wait for WRITE?

SubjectAuthor
* Is there a way to wait for WRITE?James Van Buskirk
+* Re: Is there a way to wait for WRITE?Thomas Koenig
|`* Re: Is there a way to wait for WRITE?James Van Buskirk
| +* Re: Is there a way to wait for WRITE?Thomas Koenig
| |+* Re: Is there a way to wait for WRITE?Spiros Bousbouras
| ||`- Re: Is there a way to wait for WRITE?Thomas Koenig
| |`* Re: Is there a way to wait for WRITE?James Van Buskirk
| | `* Re: Is there a way to wait for WRITE?Thomas Koenig
| |  `* Re: Is there a way to wait for WRITE?John
| |   `- Re: Is there a way to wait for WRITE?James Van Buskirk
| `* Re: Is there a way to wait for WRITE?gah4
|  `* Re: Is there a way to wait for WRITE?James Van Buskirk
|   `- Re: Is there a way to wait for WRITE?Thomas Koenig
+* Re: Is there a way to wait for WRITE?David Jones
|`* Re: Is there a way to wait for WRITE?James Van Buskirk
| +* Re: Is there a way to wait for WRITE?David Jones
| |`* Re: Is there a way to wait for WRITE?James Van Buskirk
| | `- Re: Is there a way to wait for WRITE?gah4
| +- Re: Is there a way to wait for WRITE?John
| `* Re: Is there a way to wait for WRITE?Thomas Koenig
|  `- Re: Is there a way to wait for WRITE?James Van Buskirk
`* Re: Is there a way to wait for WRITE?Gary Scott
 +- Re: Is there a way to wait for WRITE?Gary Scott
 `* Re: Is there a way to wait for WRITE?James Van Buskirk
  `* Re: Is there a way to wait for WRITE?Gary Scott
   `* Re: Is there a way to wait for WRITE?Gary Scott
    `- Re: Is there a way to wait for WRITE?Gary Scott

Pages:12
Is there a way to wait for WRITE?

<tkqav1$1duvq$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3165&group=comp.lang.fortran#3165

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 01:46:36 -0700
Organization: A noiseless patient Spider
Lines: 1
Message-ID: <tkqav1$1duvq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Nov 2022 08:47:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7054d71448358934981a7b758dffde33";
logging-data="1506298"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18P1mgPnF4Oaol6ukWbhS4eBpx0vRIEcWI="
Cancel-Lock: sha1:z+2n/0wDd3tM5/6trwCfydCn9Go=
X-Priority: 3
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
 by: James Van Buskirk - Sun, 13 Nov 2022 08:46 UTC

OK, I made some progress in my hobby project and now it
displays a graph of its results. I put a READ(*,'(a)') statement
at the end so my graphs wouldn't go away when the
program terminates.

After considerable effort I found out how to write a *.ppm
file and how to get gimp.exe to convert all of my *.ppm
files (which most software can't read) to *.png.

Then I wrote a *.bat file that permits me to run a bunch
of scenarios. Since I didn't want to have to change focus
to the CMD.exe window and hit <ENTER> for every run
of the program, I had it detect when it was running in batch
mode and skip the READ(*,'(a)') statement because the
graphs would be available in *.png form anyway.

However, this caused a problem because the last and of
course most important *.ppm doesn't complete writing
before its thread closes, so I don't get that *.ppm file.
I tried putting a FLUSH(iunit) statement before the
CLOSE(iunit) statement, but still no joy. How am I
supposed to tell the thread to wait for the *.ppm file
to get properly written and saved before returning?

Re: Is there a way to wait for WRITE?

<tkqben$38a5n$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3166&group=comp.lang.fortran#3166

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 08:55:51 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tkqben$38a5n$1@newsreader4.netcologne.de>
References: <tkqav1$1duvq$1@dont-email.me>
Injection-Date: Sun, 13 Nov 2022 08:55:51 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:144c:0:7285:c2ff:fe6c:992d";
logging-data="3418295"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sun, 13 Nov 2022 08:55 UTC

James Van Buskirk <not_valid@comcast.net> schrieb:
> OK, I made some progress in my hobby project and now it
> displays a graph of its results. I put a READ(*,'(a)') statement
> at the end so my graphs wouldn't go away when the
> program terminates.
>
> After considerable effort I found out how to write a *.ppm
> file and how to get gimp.exe to convert all of my *.ppm
> files (which most software can't read) to *.png.

You can also use the pngtopng command from netpbm, which
is a bit more lightweight than gimp :-)

> Then I wrote a *.bat file that permits me to run a bunch
> of scenarios. Since I didn't want to have to change focus
> to the CMD.exe window and hit <ENTER> for every run
> of the program, I had it detect when it was running in batch
> mode and skip the READ(*,'(a)') statement because the
> graphs would be available in *.png form anyway.

> However, this caused a problem because the last and of
> course most important *.ppm doesn't complete writing
> before its thread closes,

Do you do different threads in a main program? If
so, how? OpenMP? Coarrays? pthreads? Windows
threads?

Or did you just mean program?

>so I don't get that *.ppm file.
> I tried putting a FLUSH(iunit) statement before the
> CLOSE(iunit) statement, but still no joy. How am I
> supposed to tell the thread to wait for the *.ppm file
> to get properly written and saved before returning?

This is very hard to answer without knowing exactly what
you did, what system (I presume Windows), and what
thread model and what compiler you used.

Re: Is there a way to wait for WRITE?

<tkqfeo$1e914$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3167&group=comp.lang.fortran#3167

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 03:02:54 -0700
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <tkqfeo$1e914$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="Windows-1252";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Nov 2022 10:04:09 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7054d71448358934981a7b758dffde33";
logging-data="1516580"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HBNM/HgDt+CaulIyjQiM/QQ8W2AYkxqM="
Cancel-Lock: sha1:d3QioGp4HQKKHbP4vEGDHjwu60o=
Importance: Normal
X-Priority: 3
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
X-MSMail-Priority: Normal
In-Reply-To: <tkqben$38a5n$1@newsreader4.netcologne.de>
 by: James Van Buskirk - Sun, 13 Nov 2022 10:02 UTC

"Thomas Koenig" wrote in message
news:tkqben$38a5n$1@newsreader4.netcologne.de...

> James Van Buskirk <not_valid@comcast.net> schrieb:
> > OK, I made some progress in my hobby project and now it
> > displays a graph of its results. I put a READ(*,'(a)') statement
> > at the end so my graphs wouldn't go away when the
> > program terminates.

> > After considerable effort I found out how to write a *.ppm
> > file and how to get gimp.exe to convert all of my *.ppm
> > files (which most software can't read) to *.png.

> You can also use the pngtopng command from netpbm, which
> is a bit more lightweight than gimp :-)

Well, I installed gimp for a previous project and its licensing
arrangements seemed satisfactory. It's a bitch to use it in
batch mode, though. What would have been really cool
would have been a printer driver that had the option to
print to file with *.png being one of the accessible formats.
Then I could have rendered to the file like I have rendered
to printer previously. However, Windows doesn't come with
such goodies: Microsoft XPS Document Writer seems to be
able to embed a PNG in a *.oxps file, but I couldn't figure
out how to extract it from there. There are drivers out
there on the web that can print to *.png, but using them
would mean the my program wouldn't be self-contained.

> > Then I wrote a *.bat file that permits me to run a bunch
> > of scenarios. Since I didn't want to have to change focus
> > to the CMD.exe window and hit <ENTER> for every run
> > of the program, I had it detect when it was running in batch
> > mode and skip the READ(*,'(a)') statement because the
> > graphs would be available in *.png form anyway.

> > However, this caused a problem because the last and of
> > course most important *.ppm doesn't complete writing
> > before its thread closes,

> Do you do different threads in a main program? If
> so, how? OpenMP? Coarrays? pthreads? Windows
> threads?

> Or did you just mean program?

No, Windows threads with _beginthreadex() and the
whole 9 yards. I tried putting a WaitForSingleObject
call before program termination, but it had no effect.
Seemingly the thread (and my *.ppm file) were already
long gone by that time.

> >so I don't get that *.ppm file.
> > I tried putting a FLUSH(iunit) statement before the
> > CLOSE(iunit) statement, but still no joy. How am I
> > supposed to tell the thread to wait for the *.ppm file
> > to get properly written and saved before returning?

> This is very hard to answer without knowing exactly what
> you did, what system (I presume Windows), and what
> thread model and what compiler you used.

D:\gfortran\james>gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=C:/Program\
Files/mingw64/bin/../libexec/gcc/x86_64-w64-ming
w32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with:
.../../../src/gcc-12.2.0/configure --host=x86_64-w64-mingw32 --b
uild=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sys
root=/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64 --enable-host-shared
--disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time
=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto
--e
nable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-
version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-lib
stdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disabl
e-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as
--with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system
-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpf
r=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/p
rerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86
_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev1, Built by
MinGW-
W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64
CFLAGS='-O
2 -pipe -fno-ident -I/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64/opt/
include -I/c/buildroot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/p
rerequisites/x86_64-w64-mingw32-static/include'
CXXFLAGS='-O2 -pipe -fno-ident -
I/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64/opt/include -I/c/buildro
ot/prerequisites/x86_64-zlib-static/include -I/c/buildroot/prerequisites/x86_64-
w64-mingw32-static/include'
CPPFLAGS=' -I/c/buildroot/x86_64-1220-win32-seh-rt_v
10-rev1/mingw64/opt/include -I/c/buildroot/prerequisites/x86_64-zlib-static/incl
ude -I/c/buildroot/prerequisites/x86_64-w64-mingw32-static/include'
LDFLAGS='-pi
pe -fno-ident -L/c/buildroot/x86_64-1220-win32-seh-rt_v10-rev1/mingw64/opt/lib
-
L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/
x86_64-w64-mingw32-static/lib '
LD_FOR_TARGET=/c/buildroot/x86_64-1220-win32-seh
-rt_v10-rev1/mingw64/bin/ld.exe --with-boot-ldflags=' -Wl,--disable-dynamicbase
-static-libstdc++ -static-libgcc'
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (x86_64-win32-seh-rev1, Built by MinGW-W64 project)

As you can see, the compiler is using win32 threads rather than posix. I
had
difficulties early on so I downloaded this compiler although I am not sure
if
it is necessary to use the win32 threads gfortran compiler if you are making
threads via the Win32 API.

The program is kinda long: win.f90=33 kB, gl.f90=41 kB, xygraph.f90 = 58 kB
and even my calculational engine is 47 kB. It definitely needs Windows to
work and the ifort-compiled version just hangs without any output.
Thus, it wouldn't do much good to post the code because nobody would
have the time, energy, and ability to investigate it.

Re: Is there a way to wait for WRITE?

<tkqk55$38e2i$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3168&group=comp.lang.fortran#3168

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 11:24:21 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tkqk55$38e2i$1@newsreader4.netcologne.de>
References: <tkqav1$1duvq$1@dont-email.me>
<tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me>
Injection-Date: Sun, 13 Nov 2022 11:24:21 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:144c:0:7285:c2ff:fe6c:992d";
logging-data="3422290"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sun, 13 Nov 2022 11:24 UTC

James Van Buskirk <not_valid@comcast.net> schrieb:
> "Thomas Koenig" wrote in message
> news:tkqben$38a5n$1@newsreader4.netcologne.de...
>
>> James Van Buskirk <not_valid@comcast.net> schrieb:
>> > OK, I made some progress in my hobby project and now it
>> > displays a graph of its results. I put a READ(*,'(a)') statement
>> > at the end so my graphs wouldn't go away when the
>> > program terminates.
>
>> > After considerable effort I found out how to write a *.ppm
>> > file and how to get gimp.exe to convert all of my *.ppm
>> > files (which most software can't read) to *.png.
>
>> You can also use the pngtopng command from netpbm, which
>> is a bit more lightweight than gimp :-)
>
> Well, I installed gimp for a previous project and its licensing
> arrangements seemed satisfactory. It's a bitch to use it in
> batch mode, though.

That is what netpbm is for.

You could just do

CALL EXECUTE_COMMAND_LINE ("pngtopng yourfile.ppm > yourfile.png")

from your Fortran program, this should work. It might open a
cmd window, though.

> What would have been really cool
> would have been a printer driver that had the option to
> print to file with *.png being one of the accessible formats.
> Then I could have rendered to the file like I have rendered
> to printer previously. However, Windows doesn't come with
> such goodies: Microsoft XPS Document Writer seems to be
> able to embed a PNG in a *.oxps file, but I couldn't figure
> out how to extract it from there. There are drivers out
> there on the web that can print to *.png, but using them
> would mean the my program wouldn't be self-contained.
>
>> > Then I wrote a *.bat file that permits me to run a bunch
>> > of scenarios. Since I didn't want to have to change focus
>> > to the CMD.exe window and hit <ENTER> for every run
>> > of the program, I had it detect when it was running in batch
>> > mode and skip the READ(*,'(a)') statement because the
>> > graphs would be available in *.png form anyway.
>
>> > However, this caused a problem because the last and of
>> > course most important *.ppm doesn't complete writing
>> > before its thread closes,
>
>> Do you do different threads in a main program? If
>> so, how? OpenMP? Coarrays? pthreads? Windows
>> threads?
>
>> Or did you just mean program?
>
> No, Windows threads with _beginthreadex() and the
> whole 9 yards.

OK, then I'm afraid I cannot really help you a lot. Just a couple
of things:

The gfortran runtime knows nothing about Windows threads. You have
to make sure that there is no race condition etc. libgfortran
locking is for pthreads only (which also works for gomp).

If you are using threads, you will probably need -frecursive
to make sure that all variables are on the stack.

> I tried putting a WaitForSingleObject
> call before program termination, but it had no effect.
> Seemingly the thread (and my *.ppm file) were already
> long gone by that time.

If your thread exited (how did you do that?) it might
have cleaned up after itself in some way, and left
the runtime in an inconsistent state.

The least you probably have to do is to make sure that any I/O
library calls are only executed on a single thread, by putting
the Windows equivalent of "omp critical" around it.

>> >so I don't get that *.ppm file.
>> > I tried putting a FLUSH(iunit) statement before the
>> > CLOSE(iunit) statement, but still no joy. How am I
>> > supposed to tell the thread to wait for the *.ppm file
>> > to get properly written and saved before returning?
>
>> This is very hard to answer without knowing exactly what
>> you did, what system (I presume Windows), and what
>> thread model and what compiler you used.
>
> D:\gfortran\james>gfortran -v

[...]

> As you can see, the compiler is using win32 threads rather than posix. I
> had
> difficulties early on so I downloaded this compiler although I am not sure
> if
> it is necessary to use the win32 threads gfortran compiler if you are making
> threads via the Win32 API.

I have no idea about that, my systems programming fu is limited
to UNIX.

> The program is kinda long: win.f90=33 kB, gl.f90=41 kB, xygraph.f90 = 58 kB
> and even my calculational engine is 47 kB. It definitely needs Windows to
> work and the ifort-compiled version just hangs without any output.
> Thus, it wouldn't do much good to post the code because nobody would
> have the time, energy, and ability to investigate it.

If it's a hobby project, maybe you want to completely rewrite it in
gtk-fortran :-)

Re: Is there a way to wait for WRITE?

<931KgzoUacRkux1Pw@bongo-ra.co>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3169&group=comp.lang.fortran#3169

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spibou@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 12:10:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <931KgzoUacRkux1Pw@bongo-ra.co>
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me>
<tkqk55$38e2i$1@newsreader4.netcologne.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Nov 2022 12:10:12 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="50d251600a88d5dd1cd194954607d11e";
logging-data="1536316"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18397afFMKRuei8hgp81EYc"
Cancel-Lock: sha1:b8lhHW+nxdr36sKYSvcDIMd9IJU=
In-Reply-To: <tkqk55$38e2i$1@newsreader4.netcologne.de>
X-Organisation: Weyland-Yutani
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Sun, 13 Nov 2022 12:10 UTC

On Sun, 13 Nov 2022 11:24:21 -0000 (UTC)
Thomas Koenig <tkoenig@netcologne.de> wrote:
> James Van Buskirk <not_valid@comcast.net> schrieb:
> > "Thomas Koenig" wrote in message
> > news:tkqben$38a5n$1@newsreader4.netcologne.de...
> >
> >> James Van Buskirk <not_valid@comcast.net> schrieb:
> >> > After considerable effort I found out how to write a *.ppm
> >> > file and how to get gimp.exe to convert all of my *.ppm
> >> > files (which most software can't read) to *.png.
> >
> >> You can also use the pngtopng command from netpbm, which
> >> is a bit more lightweight than gimp :-)
> >
> > Well, I installed gimp for a previous project and its licensing
> > arrangements seemed satisfactory. It's a bitch to use it in
> > batch mode, though.
>
> That is what netpbm is for.
>
> You could just do
>
> CALL EXECUTE_COMMAND_LINE ("pngtopng yourfile.ppm > yourfile.png")
>
> from your Fortran program, this should work. It might open a
> cmd window, though.

Is there a pngtopng programme ? Do you mean pnmtopng perhaps ?

Re: Is there a way to wait for WRITE?

<tkqoji$1f0o0$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3170&group=comp.lang.fortran#3170

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 05:39:23 -0700
Organization: A noiseless patient Spider
Lines: 2
Message-ID: <tkqoji$1f0o0$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me> <tkqk55$38e2i$1@newsreader4.netcologne.de>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="Windows-1252";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Nov 2022 12:40:19 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7054d71448358934981a7b758dffde33";
logging-data="1540864"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zxoYKi/nQ97RUQv9BCphB7kxgZECVcP0="
Cancel-Lock: sha1:M4mGSbLDJfv2xut483eIW6WDcrk=
In-Reply-To: <tkqk55$38e2i$1@newsreader4.netcologne.de>
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
 by: James Van Buskirk - Sun, 13 Nov 2022 12:39 UTC

"Thomas Koenig" wrote in message
news:tkqk55$38e2i$1@newsreader4.netcologne.de...

> If you are using threads, you will probably need -frecursive
> to make sure that all variables are on the stack.

No, I explicitly declare all my procedures as recursive.

> If your thread exited (how did you do that?) it might
> have cleaned up after itself in some way, and left
> the runtime in an inconsistent state.

I think that's inconsistent with the symptoms in that
if the calling program is stalled waiting for input the
data is not lost. Maybe I will put a call Sleep(1000) or
so as a workaround but I have other stuff I have to mess
with in the immediate future.

> The least you probably have to do is to make sure that any I/O
> library calls are only executed on a single thread, by putting
> the Windows equivalent of "omp critical" around it.

In earlier testing this was no problem, just somewhat
difficult to interpret output. When the failure occurs only
the failing thread is performing I/O.

> If it's a hobby project, maybe you want to completely rewrite it in
> gtk-fortran :-)

There are problems with that project I have mentioned
long ago, and it's not really a Windows thing. Can you
create an OpenGK render context in gtk-fortran, for
example? Linux has this issue with graphics that there
are different foundations, like X11 is what non-Linux
speakers would have thought was the foundation in
Linux, but it's built on top of another package whose
name I can't recall any more. Everyone on Linux seems
to use GLUT, which is a bad sign.

Re: Is there a way to wait for WRITE?

<tkqp77$38i2t$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3172&group=comp.lang.fortran#3172

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 12:50:47 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tkqp77$38i2t$1@newsreader4.netcologne.de>
References: <tkqav1$1duvq$1@dont-email.me>
<tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me>
<tkqk55$38e2i$1@newsreader4.netcologne.de> <931KgzoUacRkux1Pw@bongo-ra.co>
Injection-Date: Sun, 13 Nov 2022 12:50:47 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:144c:0:7285:c2ff:fe6c:992d";
logging-data="3426397"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sun, 13 Nov 2022 12:50 UTC

Spiros Bousbouras <spibou@gmail.com> schrieb:
> On Sun, 13 Nov 2022 11:24:21 -0000 (UTC)
> Thomas Koenig <tkoenig@netcologne.de> wrote:
>> James Van Buskirk <not_valid@comcast.net> schrieb:
>> > "Thomas Koenig" wrote in message
>> > news:tkqben$38a5n$1@newsreader4.netcologne.de...
>> >
>> >> James Van Buskirk <not_valid@comcast.net> schrieb:
>> >> > After considerable effort I found out how to write a *.ppm
>> >> > file and how to get gimp.exe to convert all of my *.ppm
>> >> > files (which most software can't read) to *.png.
>> >
>> >> You can also use the pngtopng command from netpbm, which
>> >> is a bit more lightweight than gimp :-)
>> >
>> > Well, I installed gimp for a previous project and its licensing
>> > arrangements seemed satisfactory. It's a bitch to use it in
>> > batch mode, though.
>>
>> That is what netpbm is for.
>>
>> You could just do
>>
>> CALL EXECUTE_COMMAND_LINE ("pngtopng yourfile.ppm > yourfile.png")
>>
>> from your Fortran program, this should work. It might open a
>> cmd window, though.
>
> Is there a pngtopng programme ? Do you mean pnmtopng perhaps ?

Yes, of course.

Re: Is there a way to wait for WRITE?

<tkqucc$38kq0$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3174&group=comp.lang.fortran#3174

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 14:18:52 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tkqucc$38kq0$1@newsreader4.netcologne.de>
References: <tkqav1$1duvq$1@dont-email.me>
<tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me>
<tkqk55$38e2i$1@newsreader4.netcologne.de> <tkqoji$1f0o0$1@dont-email.me>
Injection-Date: Sun, 13 Nov 2022 14:18:52 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-144c-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:144c:0:7285:c2ff:fe6c:992d";
logging-data="3429184"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sun, 13 Nov 2022 14:18 UTC

James Van Buskirk <not_valid@comcast.net> schrieb:
> "Thomas Koenig" wrote in message
> news:tkqk55$38e2i$1@newsreader4.netcologne.de...
>
>> If you are using threads, you will probably need -frecursive
>> to make sure that all variables are on the stack.
>
> No, I explicitly declare all my procedures as recursive.
>
>> If your thread exited (how did you do that?) it might
>> have cleaned up after itself in some way, and left
>> the runtime in an inconsistent state.
>
> I think that's inconsistent with the symptoms in that
> if the calling program is stalled waiting for input the
> data is not lost.

It might still be in an inconsistent state.

libgfortran is simply not built for several threads
doing stuff without it knowing about it. It does locking,
but only for pthreads.

> so as a workaround but I have other stuff I have to mess
> with in the immediate future.

:-)

>
>> The least you probably have to do is to make sure that any I/O
>> library calls are only executed on a single thread, by putting
>> the Windows equivalent of "omp critical" around it.
>
> In earlier testing this was no problem, just somewhat
> difficult to interpret output. When the failure occurs only
> the failing thread is performing I/O.

Accessing

>
>> If it's a hobby project, maybe you want to completely rewrite it in
>> gtk-fortran :-)
>
> There are problems with that project I have mentioned
> long ago, and it's not really a Windows thing. Can you
> create an OpenGK render context in gtk-fortran, for
> example?

I assume you mean OpenGL?

Does https://docs.gtk.org/gtk4/class.GLArea.html qualify?
(I don't know a lot about OpenGL, so I am just guessing).

Re: Is there a way to wait for WRITE?

<7f7fcb28-c232-468e-9432-04801f51cbf6n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3175&group=comp.lang.fortran#3175

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:1655:b0:6e0:90df:228f with SMTP id c21-20020a05620a165500b006e090df228fmr8138716qko.756.1668353280424;
Sun, 13 Nov 2022 07:28:00 -0800 (PST)
X-Received: by 2002:a05:6214:247:b0:4bb:8572:99c5 with SMTP id
k7-20020a056214024700b004bb857299c5mr9234454qvt.77.1668353280207; Sun, 13 Nov
2022 07:28:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sun, 13 Nov 2022 07:28:00 -0800 (PST)
In-Reply-To: <tkqucc$38kq0$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:c8c8:ed96:aed1:f99d;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:c8c8:ed96:aed1:f99d
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de>
<tkqfeo$1e914$1@dont-email.me> <tkqk55$38e2i$1@newsreader4.netcologne.de>
<tkqoji$1f0o0$1@dont-email.me> <tkqucc$38kq0$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7f7fcb28-c232-468e-9432-04801f51cbf6n@googlegroups.com>
Subject: Re: Is there a way to wait for WRITE?
From: urbanjost@comcast.net (John)
Injection-Date: Sun, 13 Nov 2022 15:28:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2786
 by: John - Sun, 13 Nov 2022 15:28 UTC

No direct help for the issues you describe that someone has not mentioned already, but if you are just writing Poskanzer pixelmaps from a batch problem I would mention a few other possibilities

It sounds like you using a lot of MSWIndows-specific components, threaded, and so on. On the other hand you seem to be creating a P6 file at a low level. If you have an internal array representing a pixel map you might consider writing GIF; I have used

https://fortranwiki.org/fortran/show/writegif

which is in Fortran and so can be very portable with no dependencies.

I am a fan of Netpbm+ for batch use, and have generated low-level P6 graphics quite a bit (even have a hopefully portable module just for that); see https://github.com/urbanjost/M_pixel and https://github.com/urbanjost/M_draw for example. That approach can work very well for simple projects where longevity and portability matter; particularly with batch-generated graphics (I have programs that have been on dozens of OSes and are decades old still running taking that approach) but it is not the way to go for high-level event-driven threaded codes or for most high-level graphics. So not quite sure such a low-level approach is of any use; but thought I would mention it as you are mentioning P6 files (again, have used them for years with great success).

Re: Is there a way to wait for WRITE?

<tkr3gq$nkk$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3176&group=comp.lang.fortran#3176

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!/Adh2v7LvPPHwMhGJ8JsiA.user.46.165.242.91.POSTED!not-for-mail
From: dajhawkxx@nowherel.com (David Jones)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 15:46:34 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <tkr3gq$nkk$1@gioia.aioe.org>
References: <tkqav1$1duvq$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="24212"; posting-host="/Adh2v7LvPPHwMhGJ8JsiA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.21-f3fb89f (x86; Portable ISpell)
X-Notice: Filtered by postfilter v. 0.9.2
 by: David Jones - Sun, 13 Nov 2022 15:46 UTC

James Van Buskirk wrote:

> OK, I made some progress in my hobby project and now it
> displays a graph of its results. I put a READ(*,'(a)') statement
> at the end so my graphs wouldn't go away when the
> program terminates.
>
> After considerable effort I found out how to write a *.ppm
> file and how to get gimp.exe to convert all of my *.ppm
> files (which most software can't read) to *.png.
>
> Then I wrote a *.bat file that permits me to run a bunch
> of scenarios. Since I didn't want to have to change focus
> to the CMD.exe window and hit <ENTER> for every run
> of the program, I had it detect when it was running in batch
> mode and skip the READ(*,'(a)') statement because the
> graphs would be available in *.png form anyway.
>
> However, this caused a problem because the last and of
> course most important *.ppm doesn't complete writing
> before its thread closes, so I don't get that *.ppm file.
> I tried putting a FLUSH(iunit) statement before the
> CLOSE(iunit) statement, but still no joy. How am I
> supposed to tell the thread to wait for the *.ppm file
> to get properly written and saved before returning?

Have you tried a WAIT or SLEEP function to provide the required delay
of a small faction of a second, as judged by experience?

Re: Is there a way to wait for WRITE?

<tkrjfj$1h7po$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3178&group=comp.lang.fortran#3178

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: garylscott@sbcglobal.net (Gary Scott)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 14:18:59 -0600
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <tkrjfj$1h7po$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Nov 2022 20:18:59 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="90facf10deccd422b8d825d11f9158c1";
logging-data="1613624"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DMraA5kXlHFy6orKLNSwieMR2LbtQnXw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:xDcBUDjUVSqt6p8Che/qc8YxLi4=
In-Reply-To: <tkqav1$1duvq$1@dont-email.me>
Content-Language: en-US
 by: Gary Scott - Sun, 13 Nov 2022 20:18 UTC

On 11/13/2022 2:46 AM, James Van Buskirk wrote:
> OK, I made some progress in my hobby project and now it
> displays a graph of its results.  I put a READ(*,'(a)') statement
> at the end so my graphs wouldn't go away when the
> program terminates.
>
> After considerable effort I found out how to write a *.ppm
> file and how to get gimp.exe to convert all of my *.ppm
> files (which most software can't read) to *.png.
>
> Then I wrote a *.bat file that permits me to run a bunch
> of scenarios.  Since I didn't want to have to change focus
> to the CMD.exe window and hit <ENTER> for every run
> of the program, I had it detect when it was running in batch
> mode and skip the READ(*,'(a)') statement because the
> graphs would be available in *.png form anyway.
>
> However, this caused a problem because the last and of
> course most important *.ppm doesn't complete writing
> before its thread closes, so I don't get that *.ppm file.
> I tried putting a FLUSH(iunit) statement before the
> CLOSE(iunit) statement, but still no joy.  How am I
> supposed to tell the thread to wait for the *.ppm file
> to get properly written and saved before returning?

I sometimes use a shared memory buffer to communication with separate
processes or threads. Example of the win32 api for this is here:

https://www.fortranlib.com/ShareBufferWin32.f90

You can make it virtually any size you want. I sometimes use various
flags (wait, kill, etc.) to synchronize with hardware or software.
>

Re: Is there a way to wait for WRITE?

<tkrjmd$1h7po$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3179&group=comp.lang.fortran#3179

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: garylscott@sbcglobal.net (Gary Scott)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 14:22:37 -0600
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <tkrjmd$1h7po$2@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkrjfj$1h7po$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Nov 2022 20:22:38 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="90facf10deccd422b8d825d11f9158c1";
logging-data="1613624"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zH26Tqyrs9gFHM3AgZFUb5jIrE4ozU2I="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:sBUz/v+e62uDHN6tn293mZe+BDQ=
Content-Language: en-US
In-Reply-To: <tkrjfj$1h7po$1@dont-email.me>
 by: Gary Scott - Sun, 13 Nov 2022 20:22 UTC

On 11/13/2022 2:18 PM, Gary Scott wrote:
> On 11/13/2022 2:46 AM, James Van Buskirk wrote:
>> OK, I made some progress in my hobby project and now it
>> displays a graph of its results.  I put a READ(*,'(a)') statement
>> at the end so my graphs wouldn't go away when the
>> program terminates.
>>
>> After considerable effort I found out how to write a *.ppm
>> file and how to get gimp.exe to convert all of my *.ppm
>> files (which most software can't read) to *.png.
>>
>> Then I wrote a *.bat file that permits me to run a bunch
>> of scenarios.  Since I didn't want to have to change focus
>> to the CMD.exe window and hit <ENTER> for every run
>> of the program, I had it detect when it was running in batch
>> mode and skip the READ(*,'(a)') statement because the
>> graphs would be available in *.png form anyway.
>>
>> However, this caused a problem because the last and of
>> course most important *.ppm doesn't complete writing
>> before its thread closes, so I don't get that *.ppm file.
>> I tried putting a FLUSH(iunit) statement before the
>> CLOSE(iunit) statement, but still no joy.  How am I
>> supposed to tell the thread to wait for the *.ppm file
>> to get properly written and saved before returning?
>
> I sometimes use a shared memory buffer to communication with separate
> processes or threads.  Example of the win32 api for this is here:
>
> https://www.fortranlib.com/ShareBufferWin32.f90
>
> You can make it virtually any size you want.  I sometimes use various
> flags (wait, kill, etc.) to synchronize with hardware or software.
>>
>

Here's the example at the bottom of the linked file:

!
! Example Main Program 1
! ! integer :: iretcode, bufptr, buffer(1024)
! ! pointer (bufptr,buffer)
! !
! call CreateShareBuffer('TestBuf',4096,bufptr,iretcode)
! !
! ...code using BUFFER goes here.
! ! ...when finished...
! !
! call DeleteShareBuffer(bufptr,iretcode)
! ! end
! !
! ! Example Main Program 2 (3, 4, etc.)
! ! integer :: iretcode, bufptr, buffer(1024)
! ! pointer (bufptr,buffer)
! !
! call OpenShareBuffer('TestBuf',bufptr,iretcode)
! !
! ...code using BUFFER goes here.
! ! ...when finished...
! !
! call CloseShareBuffer(bufptr,iretcode)
! ! end

Re: Is there a way to wait for WRITE?

<tkrjvk$1havh$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3180&group=comp.lang.fortran#3180

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 13:26:32 -0700
Organization: A noiseless patient Spider
Lines: 3
Message-ID: <tkrjvk$1havh$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me> <tkqk55$38e2i$1@newsreader4.netcologne.de> <tkqoji$1f0o0$1@dont-email.me> <tkqucc$38kq0$1@newsreader4.netcologne.de> <7f7fcb28-c232-468e-9432-04801f51cbf6n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="UTF-8";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Nov 2022 20:27:32 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7dce6ba8e4e51cb8e235faa8b4d80f8f";
logging-data="1616881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FStlitMWQwvHDXF2ynu9mP1odw4qUq9c="
Cancel-Lock: sha1:NfthRAAxomUZaJI8yhJnPnQ5R5c=
In-Reply-To: <7f7fcb28-c232-468e-9432-04801f51cbf6n@googlegroups.com>
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
X-MSMail-Priority: Normal
X-Priority: 3
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
 by: James Van Buskirk - Sun, 13 Nov 2022 20:26 UTC

"John" wrote in message
news:7f7fcb28-c232-468e-9432-04801f51cbf6n@googlegroups.com...

> No direct help for the issues you describe that someone has
> not mentioned already, but if you are just writing Poskanzer
> pixelmaps from a batch problem I would mention a few other
> possibilities

> It sounds like you using a lot of MSWIndows-specific
> components, threaded, and so on. On the other hand you
> seem to be creating a P6 file at a low level. If you have an
> internal array representing a pixel map you might consider
> writing GIF; I have used

> https://fortranwiki.org/fortran/show/writegif

It's too bad it's writing GIFs rather than PNGs. It doesn't
seem to incorporate the capability to write animated GIFs
and GIFs have limitations.

> which is in Fortran and so can be very portable with
> no dependencies.

> I am a fan of Netpbm+ for batch use, and have generated
> low-level P6 graphics quite a bit (even have a hopefully
> portable module just for that); see
> https://github.com/urbanjost/M_pixel and
> https://github.com/urbanjost/M_draw
> for example. That approach can work very well for
> simple projects where longevity and portability matter;
> particularly with batch-generated graphics (I have programs
> that have been on dozens of OSes and are decades old still
> running taking that approach) but it is not the way to go
> for high-level event-driven threaded codes or for most
> high-level graphics. So not quite sure such a low-level
> approach is of any use; but thought I would mention it
> as you are mentioning P6 files (again, have used them for
> years with great success).

Yeah, P6 *.ppm is the graphics file format for the rest of us:
you can just look at the specification and generate graphics
files immediately. It's too bad that more software can't
read them.

I see that M_pixel does do animated GIFs. It's a pity that
there isn't an obvious link on the page that tells you how
to download the package. I can't understand why GitHub
doesn't provide that.

I would just do raw raster graphics if it weren't for the fonts.
You know, like a Fortran mathjax to raster library :)

Re: Is there a way to wait for WRITE?

<tkrkfj$1hcek$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3181&group=comp.lang.fortran#3181

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 13:35:04 -0700
Organization: A noiseless patient Spider
Lines: 2
Message-ID: <tkrkfj$1hcek$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkr3gq$nkk$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Nov 2022 20:36:03 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7dce6ba8e4e51cb8e235faa8b4d80f8f";
logging-data="1618388"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bvNooY1GmYpdpRFTgREgeoxQ9mCVOfGM="
Cancel-Lock: sha1:TW+to98nDOxsY9fsDYDMYSBVgEE=
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
In-Reply-To: <tkr3gq$nkk$1@gioia.aioe.org>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
 by: James Van Buskirk - Sun, 13 Nov 2022 20:35 UTC

"David Jones" wrote in message news:tkr3gq$nkk$1@gioia.aioe.org...

> > James Van Buskirk wrote:
> > However, this caused a problem because the last and of
> > course most important *.ppm doesn't complete writing
> > before its thread closes, so I don't get that *.ppm file.
> > I tried putting a FLUSH(iunit) statement before the
> > CLOSE(iunit) statement, but still no joy. How am I
> > supposed to tell the thread to wait for the *.ppm file
> > to get properly written and saved before returning?

> Have you tried a WAIT or SLEEP function to provide the required delay
> of a small faction of a second, as judged by experience?

Yeah, that's the first thing I plan to try when I get the
resources (time and energy) to struggle with this problem
again. It might need to be a couple of seconds, but the
overall program takes a couple of minutes to run at
parameters near to what currently makes it crash by
flying too close to the sun.

Re: Is there a way to wait for WRITE?

<tkrkst$1hdgg$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3182&group=comp.lang.fortran#3182

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 13:42:10 -0700
Organization: A noiseless patient Spider
Lines: 1
Message-ID: <tkrkst$1hdgg$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkrjfj$1h7po$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="UTF-8";
reply-type=response
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Nov 2022 20:43:10 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7dce6ba8e4e51cb8e235faa8b4d80f8f";
logging-data="1619472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wNsEgpHcWa7tQchRsZB2L0KiKRmbB3Ew="
Cancel-Lock: sha1:hxaISFPU845KCbCdJ9cnuUcBItQ=
In-Reply-To: <tkrjfj$1h7po$1@dont-email.me>
Importance: Normal
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
 by: James Van Buskirk - Sun, 13 Nov 2022 20:42 UTC

"Gary Scott" wrote in message news:tkrjfj$1h7po$1@dont-email.me...

> I sometimes use a shared memory buffer to communication with separate
> processes or threads. Example of the win32 api for this is here:

> https://www.fortranlib.com/ShareBufferWin32.f90

> You can make it virtually any size you want. I sometimes use various
> flags (wait, kill, etc.) to synchronize with hardware or software.

I seems that your solution would be to create a shared buffer that
the dying thread would allocate and fill with data in its last gasp
and then the main program would write the data to file.

I think that might work but I was hoping for a solution that
preserved the current division of labor.

Re: Is there a way to wait for WRITE?

<tkrs1g$1q1t$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3183&group=comp.lang.fortran#3183

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!/Adh2v7LvPPHwMhGJ8JsiA.user.46.165.242.91.POSTED!not-for-mail
From: dajhawkxx@nowherel.com (David Jones)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 22:45:04 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <tkrs1g$1q1t$1@gioia.aioe.org>
References: <tkqav1$1duvq$1@dont-email.me> <tkr3gq$nkk$1@gioia.aioe.org> <tkrkfj$1hcek$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="59453"; posting-host="/Adh2v7LvPPHwMhGJ8JsiA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.21-f3fb89f (x86; Portable ISpell)
X-Notice: Filtered by postfilter v. 0.9.2
 by: David Jones - Sun, 13 Nov 2022 22:45 UTC

James Van Buskirk wrote:

> "David Jones" wrote in message news:tkr3gq$nkk$1@gioia.aioe.org...
> >> James Van Buskirk wrote:
> >> However, this caused a problem because the last and of
> >> course most important *.ppm doesn't complete writing
> >> before its thread closes, so I don't get that *.ppm file.
> >> I tried putting a FLUSH(iunit) statement before the
> >> CLOSE(iunit) statement, but still no joy. How am I
> >> supposed to tell the thread to wait for the *.ppm file
> >> to get properly written and saved before returning?
>
> > Have you tried a WAIT or SLEEP function to provide the required
> > delay of a small faction of a second, as judged by experience?
>
> Yeah, that's the first thing I plan to try when I get the
> resources (time and energy) to struggle with this problem
> again. It might need to be a couple of seconds, but the
> overall program takes a couple of minutes to run at
> parameters near to what currently makes it crash by
> flying too close to the sun.

A possible (flexible on time?) strategy might be to interactively try
to open-for-exclusive-read the file once you have closed it, with a
WAIT or SLEEP between tries. THIs mighrt ensure the system thinks the
file properly exists before you close the program.

Re: Is there a way to wait for WRITE?

<10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3184&group=comp.lang.fortran#3184

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:c785:0:b0:4bb:63be:9994 with SMTP id k5-20020a0cc785000000b004bb63be9994mr10360940qvj.111.1668383256794;
Sun, 13 Nov 2022 15:47:36 -0800 (PST)
X-Received: by 2002:ac8:6617:0:b0:3a5:27c6:6d98 with SMTP id
c23-20020ac86617000000b003a527c66d98mr10054056qtp.647.1668383256656; Sun, 13
Nov 2022 15:47:36 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sun, 13 Nov 2022 15:47:36 -0800 (PST)
In-Reply-To: <tkqfeo$1e914$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:d9a1:3edd:f73c:579d;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:d9a1:3edd:f73c:579d
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de>
<tkqfeo$1e914$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com>
Subject: Re: Is there a way to wait for WRITE?
From: gah4@u.washington.edu (gah4)
Injection-Date: Sun, 13 Nov 2022 23:47:36 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2771
 by: gah4 - Sun, 13 Nov 2022 23:47 UTC

On Sunday, November 13, 2022 at 2:04:12 AM UTC-8, James Van Buskirk wrote:

(snip)

> No, Windows threads with _beginthreadex() and the
> whole 9 yards. I tried putting a WaitForSingleObject
> call before program termination, but it had no effect.
> Seemingly the thread (and my *.ppm file) were already
> long gone by that time.

Sounds like a Windows bug.

Any asynchronous operation should have the ability to WAIT for
it to finish.

Fortran asynchronous I/O has a WAIT statement such that you can
wait for the operation to be done. For READ, you can't look at the data
until after the WAIT. For WRITE, you can't reuse the output buffer until
after WAIT.

For OS/360, I/O is naturally asynchronous, each operation has an ECB
(Event Control Block) which is used with a WAIT macro. And as above,
you can't use the read data, or reuse the output buffer, until the WAIT
has finished.

So, for example, you do double buffer I/O by starting two READ operations,
and then WAITing for the first. When it is done, you use the data supplied.
(Or copy it away somewhere.) Then start the third and WAIT for the second.

And subtasks also have an ECB and you can WAIT for them.

IBM versions of PL/I have EVENT variables, which most likely have
the ECB inside them, and a WAIT statement. That is used for both
asynchronous I/O and subtasks.

Asynchronous operations are pretty fundamental in Unix, too.

It might be, though, that they were added on later to Windows, and not
so well integrated as they could have been.

Re: Is there a way to wait for WRITE?

<tks15g$1id5p$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3185&group=comp.lang.fortran#3185

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: garylscott@sbcglobal.net (Gary Scott)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 18:12:32 -0600
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <tks15g$1id5p$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkrjfj$1h7po$1@dont-email.me>
<tkrkst$1hdgg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Nov 2022 00:12:32 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0520474944ac610cd3f0a336d27308ba";
logging-data="1651897"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Z3og1YAi5wD+vyA2PUM/tGvXuuymrX7E="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:yk8+Wv74YqLZfYYjgEj7Au/HklM=
In-Reply-To: <tkrkst$1hdgg$1@dont-email.me>
Content-Language: en-US
 by: Gary Scott - Mon, 14 Nov 2022 00:12 UTC

On 11/13/2022 2:42 PM, James Van Buskirk wrote:
> "Gary Scott"  wrote in message news:tkrjfj$1h7po$1@dont-email.me...
>> I sometimes use a shared memory buffer to communication with separate
>> processes or threads.  Example of the win32 api for this is here:
>
>> https://www.fortranlib.com/ShareBufferWin32.f90
>
>> You can make it virtually any size you want.  I sometimes use various
>> flags (wait, kill, etc.) to synchronize with hardware or software.
>
> I seems that your solution would be to create a shared buffer that
> the dying thread would allocate and fill with data in its last gasp
> and then the main program would write the data to file.
>
> I think that might work but I was hoping for a solution that
> preserved the current division of labor.
>
I don't think the division of labor would need to change, just use one
or two shared variables (in the swap file) to communicate between the
threads and synchronize as needed. Maybe when the thread is done, it
sets a shared flag when it completes or it waits until the main sets a
flag to allow the thread to continue/process. Better than an arbitrary
wait/delay.

Re: Is there a way to wait for WRITE?

<tks7d5$1iu1r$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3186&group=comp.lang.fortran#3186

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: garylscott@sbcglobal.net (Gary Scott)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 19:59:01 -0600
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <tks7d5$1iu1r$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkrjfj$1h7po$1@dont-email.me>
<tkrkst$1hdgg$1@dont-email.me> <tks15g$1id5p$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Nov 2022 01:59:01 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0520474944ac610cd3f0a336d27308ba";
logging-data="1669179"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hCIBdtEtbpwa60p9WuXO7+SrJ7llh1ZE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:QxjquFKUkIvLA+fjZqAuK2DdSIM=
Content-Language: en-US
In-Reply-To: <tks15g$1id5p$1@dont-email.me>
 by: Gary Scott - Mon, 14 Nov 2022 01:59 UTC

On 11/13/2022 6:12 PM, Gary Scott wrote:
> On 11/13/2022 2:42 PM, James Van Buskirk wrote:
>> "Gary Scott"  wrote in message news:tkrjfj$1h7po$1@dont-email.me...
>>> I sometimes use a shared memory buffer to communication with separate
>>> processes or threads.  Example of the win32 api for this is here:
>>
>>> https://www.fortranlib.com/ShareBufferWin32.f90
>>
>>> You can make it virtually any size you want.  I sometimes use various
>>> flags (wait, kill, etc.) to synchronize with hardware or software.
>>
>> I seems that your solution would be to create a shared buffer that
>> the dying thread would allocate and fill with data in its last gasp
>> and then the main program would write the data to file.
>>
>> I think that might work but I was hoping for a solution that
>> preserved the current division of labor.
>>
> I don't think the division of labor would need to change, just use one
> or two shared variables (in the swap file) to communicate between the
> threads and synchronize as needed.  Maybe when the thread is done, it
> sets a shared flag when it completes or it waits until the main sets a
> flag to allow the thread to continue/process.  Better than an arbitrary
> wait/delay.
Another possibility that I sometimes use is shared file access. On
windows, I'll reserve usually a header at the beginning of the file
(usually direct access, but it works with stream and other forms as
well). The header may contain a flag to indicate the availability state
for reading or writing by other processes (or threads). In my
application, I also implemented record locks in each record (and
timestamps at beginning and end of record and check sums, etc.). It
seems completely reliable. I've never had a data corruption in decades
and billions of read/writes, knock on wood :)

SHARE
'DENYRW'
'DENYWR'
'DENYRD'
'DENYNONE'
File locking
'DENYWR'
Note: The default differs under certain conditions (see SHARE Specifier).
Other notes:
'DENYWR': on Linux* and macOS systems, the default depends only on the
FORM setting.
'DENYRD': applies to Windows.
SHARED
No value
File sharing allowed
Linux* and macOS: SHARED
Windows: Not shared

Re: Is there a way to wait for WRITE?

<tks82a$1iu1r$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3187&group=comp.lang.fortran#3187

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: garylscott@sbcglobal.net (Gary Scott)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 20:10:18 -0600
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <tks82a$1iu1r$2@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkrjfj$1h7po$1@dont-email.me>
<tkrkst$1hdgg$1@dont-email.me> <tks15g$1id5p$1@dont-email.me>
<tks7d5$1iu1r$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Nov 2022 02:10:18 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0520474944ac610cd3f0a336d27308ba";
logging-data="1669179"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PgaawBbQNmfB9VVftcZrKG/NkOxhTqhw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:onMrLelIrpJlcgjOoWCqHaqN/28=
Content-Language: en-US
In-Reply-To: <tks7d5$1iu1r$1@dont-email.me>
 by: Gary Scott - Mon, 14 Nov 2022 02:10 UTC

On 11/13/2022 7:59 PM, Gary Scott wrote:
> On 11/13/2022 6:12 PM, Gary Scott wrote:
>> On 11/13/2022 2:42 PM, James Van Buskirk wrote:
>>> "Gary Scott"  wrote in message news:tkrjfj$1h7po$1@dont-email.me...
>>>> I sometimes use a shared memory buffer to communication with
>>>> separate processes or threads.  Example of the win32 api for this is
>>>> here:
>>>
>>>> https://www.fortranlib.com/ShareBufferWin32.f90
>>>
>>>> You can make it virtually any size you want.  I sometimes use
>>>> various flags (wait, kill, etc.) to synchronize with hardware or
>>>> software.
>>>
>>> I seems that your solution would be to create a shared buffer that
>>> the dying thread would allocate and fill with data in its last gasp
>>> and then the main program would write the data to file.
>>>
>>> I think that might work but I was hoping for a solution that
>>> preserved the current division of labor.
>>>
>> I don't think the division of labor would need to change, just use one
>> or two shared variables (in the swap file) to communicate between the
>> threads and synchronize as needed.  Maybe when the thread is done, it
>> sets a shared flag when it completes or it waits until the main sets a
>> flag to allow the thread to continue/process.  Better than an
>> arbitrary wait/delay.
> Another possibility that I sometimes use is shared file access.  On
> windows, I'll reserve usually a header at the beginning of the file
> (usually direct access, but it works with stream and other forms as
> well).  The header may contain a flag to indicate the availability state
> for reading or writing by other processes (or threads).  In my
> application, I also implemented record locks in each record (and
> timestamps at beginning and end of record and check sums, etc.).  It
> seems completely reliable.  I've never had a data corruption in decades
> and billions of read/writes, knock on wood :)
>
> SHARE
> 'DENYRW'
> 'DENYWR'
> 'DENYRD'
> 'DENYNONE'
> File locking
> 'DENYWR'
> Note: The default differs under certain conditions (see SHARE Specifier).
> Other notes:
> 'DENYWR': on Linux* and macOS systems, the default depends only on the
> FORM setting.
> 'DENYRD': applies to Windows.
> SHARED
> No value
> File sharing allowed
> Linux* and macOS: SHARED
> Windows: Not shared
Of course you have to be careful with some forms as they will truncate
the file if you try to write to a "header". You'll have to open the
file with a form that allows you to "tweak" the contents in place.

Re: Is there a way to wait for WRITE?

<tksa8r$1m0b0$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3188&group=comp.lang.fortran#3188

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 19:46:55 -0700
Organization: A noiseless patient Spider
Lines: 2
Message-ID: <tksa8r$1m0b0$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me> <10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="UTF-8";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 14 Nov 2022 02:47:55 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7c7877719b0efa49ab7bb0807847e895";
logging-data="1769824"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lwF3PWeq815kYAuYkcEfEMWo6s9gwZj0="
Cancel-Lock: sha1:D0ChCbRi+Y3xuNutOitgNSBBQsM=
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
In-Reply-To: <10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com>
X-Priority: 3
Importance: Normal
 by: James Van Buskirk - Mon, 14 Nov 2022 02:46 UTC

"gah4" wrote in message
news:10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com...

> Fortran asynchronous I/O has a WAIT statement such that you can
> wait for the operation to be done. For READ, you can't look at the data
> until after the WAIT. For WRITE, you can't reuse the output buffer until
> after WAIT.

I didn't realize that the committee had sneaked asynchronous I/O in
there. Unfortunately, as Thomas Koenig said, it doesn't work in
gfortran on Windows.

Re: Is there a way to wait for WRITE?

<tksb8c$1m2vl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3189&group=comp.lang.fortran#3189

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: not_valid@comcast.net (James Van Buskirk)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Sun, 13 Nov 2022 20:03:45 -0700
Organization: A noiseless patient Spider
Lines: 1
Message-ID: <tksb8c$1m2vl$1@dont-email.me>
References: <tkqav1$1duvq$1@dont-email.me> <tkr3gq$nkk$1@gioia.aioe.org> <tkrkfj$1hcek$1@dont-email.me> <tkrs1g$1q1t$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=original
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 14 Nov 2022 03:04:44 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7c7877719b0efa49ab7bb0807847e895";
logging-data="1772533"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cGQKly6La/1WOpk+WCJdZ6lszIH/uHes="
Cancel-Lock: sha1:Ay1YLP7Ctj3ZKteD83L87uSATwE=
X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331
X-MSMail-Priority: Normal
X-Priority: 3
X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331
Importance: Normal
In-Reply-To: <tkrs1g$1q1t$1@gioia.aioe.org>
 by: James Van Buskirk - Mon, 14 Nov 2022 03:03 UTC

"David Jones" wrote in message news:tkrs1g$1q1t$1@gioia.aioe.org...

> A possible (flexible on time?) strategy might be to interactively try
> to open-for-exclusive-read the file once you have closed it, with a
> WAIT or SLEEP between tries. THIs mighrt ensure the system thinks the
> file properly exists before you close the program.

call Sleep(1000)

seemed to work consistently and I don't want to spend too much
time on this problem. What happens if you can open for exclusive
read and then the writing process decides that now is the time to
open the file for writing?

Re: Is there a way to wait for WRITE?

<f4f233e4-c9dc-4f24-bb00-e97b882bca03n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3190&group=comp.lang.fortran#3190

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:6e8d:0:b0:3a5:ae62:7b5a with SMTP id c13-20020ac86e8d000000b003a5ae627b5amr11087273qtv.595.1668404428258;
Sun, 13 Nov 2022 21:40:28 -0800 (PST)
X-Received: by 2002:ac8:4698:0:b0:3a5:258c:d694 with SMTP id
g24-20020ac84698000000b003a5258cd694mr11031797qto.300.1668404428107; Sun, 13
Nov 2022 21:40:28 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sun, 13 Nov 2022 21:40:27 -0800 (PST)
In-Reply-To: <tksb8c$1m2vl$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:30a1:7b61:a96f:351e;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:30a1:7b61:a96f:351e
References: <tkqav1$1duvq$1@dont-email.me> <tkr3gq$nkk$1@gioia.aioe.org>
<tkrkfj$1hcek$1@dont-email.me> <tkrs1g$1q1t$1@gioia.aioe.org> <tksb8c$1m2vl$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f4f233e4-c9dc-4f24-bb00-e97b882bca03n@googlegroups.com>
Subject: Re: Is there a way to wait for WRITE?
From: gah4@u.washington.edu (gah4)
Injection-Date: Mon, 14 Nov 2022 05:40:28 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 19
 by: gah4 - Mon, 14 Nov 2022 05:40 UTC

On Sunday, November 13, 2022 at 7:04:47 PM UTC-8, James Van Buskirk wrote:

(snip)

> seemed to work consistently and I don't want to spend too much
> time on this problem. What happens if you can open for exclusive
> read and then the writing process decides that now is the time to
> open the file for writing?

One of the fun things about Unix is that it mostly doesn't even try to
do file locking. Programs can do any (more than one) thing to a file
at the same time, sometimes with strange results.

Windows tries to do file locking, more often than not, locking you
out from something you should be able to do.

The computer that I write this on is a MacBook Air with some disks
NFS mounted off servers on the network. I had to put nolocks on
the NFS mount command, otherwise it keeps locking them when
it isn't supposed to.

Re: Is there a way to wait for WRITE?

<tksnso$39t5k$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3191&group=comp.lang.fortran#3191

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-1b20-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way to wait for WRITE?
Date: Mon, 14 Nov 2022 06:40:24 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tksnso$39t5k$1@newsreader4.netcologne.de>
References: <tkqav1$1duvq$1@dont-email.me>
<tkqben$38a5n$1@newsreader4.netcologne.de> <tkqfeo$1e914$1@dont-email.me>
<10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com>
<tksa8r$1m0b0$1@dont-email.me>
Injection-Date: Mon, 14 Nov 2022 06:40:24 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-1b20-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:1b20:0:7285:c2ff:fe6c:992d";
logging-data="3470516"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 14 Nov 2022 06:40 UTC

James Van Buskirk <not_valid@comcast.net> schrieb:
> "gah4" wrote in message
> news:10f6e9a0-658b-41db-b500-cf1474588555n@googlegroups.com...
>
>> Fortran asynchronous I/O has a WAIT statement such that you can
>> wait for the operation to be done. For READ, you can't look at the data
>> until after the WAIT. For WRITE, you can't reuse the output buffer until
>> after WAIT.
>
> I didn't realize that the committee had sneaked asynchronous I/O in
> there. Unfortunately, as Thomas Koenig said, it doesn't work in
> gfortran on Windows.

The committee left in a loophole so that it was OK for asynchronous
I/O to be done synchronously, which how gfortran implemented it
until 2018.

The implementation is built on pthreads, though.

Re: Is there a way to wait for WRITE?

<7d545d12-84f3-4dfc-9fc3-d19c0a40128cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3197&group=comp.lang.fortran#3197

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:549a:0:b0:3a5:28eb:82e with SMTP id h26-20020ac8549a000000b003a528eb082emr12484460qtq.674.1668437007950;
Mon, 14 Nov 2022 06:43:27 -0800 (PST)
X-Received: by 2002:ac8:5954:0:b0:39d:3b6:3779 with SMTP id
20-20020ac85954000000b0039d03b63779mr12296502qtz.196.1668437007767; Mon, 14
Nov 2022 06:43:27 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 14 Nov 2022 06:43:27 -0800 (PST)
In-Reply-To: <tkrkfj$1hcek$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:1923:e1b2:755d:ee73;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:1923:e1b2:755d:ee73
References: <tkqav1$1duvq$1@dont-email.me> <tkr3gq$nkk$1@gioia.aioe.org> <tkrkfj$1hcek$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7d545d12-84f3-4dfc-9fc3-d19c0a40128cn@googlegroups.com>
Subject: Re: Is there a way to wait for WRITE?
From: urbanjost@comcast.net (John)
Injection-Date: Mon, 14 Nov 2022 14:43:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3390
 by: John - Mon, 14 Nov 2022 14:43 UTC

On Sunday, November 13, 2022 at 3:36:07 PM UTC-5, James Van Buskirk wrote:
> "David Jones" wrote in message news:tkr3gq$nkk$1...@gioia.aioe.org...
> > > James Van Buskirk wrote:
> > > However, this caused a problem because the last and of
> > > course most important *.ppm doesn't complete writing
> > > before its thread closes, so I don't get that *.ppm file.
> > > I tried putting a FLUSH(iunit) statement before the
> > > CLOSE(iunit) statement, but still no joy. How am I
> > > supposed to tell the thread to wait for the *.ppm file
> > > to get properly written and saved before returning?
>
> > Have you tried a WAIT or SLEEP function to provide the required delay
> > of a small faction of a second, as judged by experience?
> Yeah, that's the first thing I plan to try when I get the
> resources (time and energy) to struggle with this problem
> again. It might need to be a couple of seconds, but the
> overall program takes a couple of minutes to run at
> parameters near to what currently makes it crash by
> flying too close to the sun.
RE: Tips on downloading a github package ...

When you are looking at github packages, you can use a git command (or git GUI) and copy an entire repo to your platform, as in

git clone https://github.com/urbanjost/M_draw.git

or if you are an fpm(1) user you can just list the repository as a dependency; if the maintainer made
a release file that should be a single file in zip or tar format that contains the entire repository;

but if not a git user and there is no release files for specific versions, a regular download is (oddly)
under the [CODE] button on the right (not the [CODE] button on the upper left). It gives you an option
there to download the project as a ZIP file that is built on the file.

RE: fonts

Yeah, currently M_pixel just has a couple of built-in Hershey vector fonts; M_draw has a much better Hershey font support and very basic hardware font support on devices that have them; for my uses that works very well as it is highly portable; but not very attractive.

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor