PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD22] Question about HFSQL files in multi threaded application
[WD22] Question about HFSQL files in multi threaded application
Iniciado por rob, 18,dic. 2017 21:54 - 1 respuesta
Miembro registrado
105 mensajes
Publicado el 18,diciembre 2017 - 21:54
Hi everyone.

I've written a service in WD22 that is basically a multi-threaded TCP socket server. It accepts connections from other applications, carries out a process that may require it to access one of a couple local HFSQL file.

My question is, how do those pointers to the files work in a multi-threaded application? I seem to be very occasional running into a crash where it's trying to modify one of those files, but it's getting an error "file is read-only. Unable to perform the operation."

Currently, the way I'm handling those files is in the procedure that is doing the modification"
I issue HOpen(file)
HReadSeekFirst() to find the desired record
if HFound() = true then
HModify()
Else
HAdd()
End
HClose()


Should I instead issue an HOpen() in the application init procedure and just leave it open?

Thanks!
Publicado el 18,diciembre 2017 - 22:35
Hi Robert,

it depends how you create your thread, and the help of the thread
functions explains clearly the different cases relating to the FH context.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 12/18/2017 à 3:54 PM, Robert a écrit :
Hi everyone.

I've written a service in WD22 that is basically a multi-threaded TCP
socket server. It accepts connections from other applications, carries
out a process that may require it to access one of a couple local HFSQL
file.

My question is, how do those pointers to the files work in a
multi-threaded application? I seem to be very occasional running into a
crash where it's trying to modify one of those files, but it's getting
an error "file is read-only. Unable to perform the operation."

Currently, the way I'm handling those files is in the procedure that is
doing the modification"
I issue HOpen(file) HReadSeekFirst() to find the desired record
if HFound() = true then
    HModify()
Else
    HAdd()
End
HClose()


Should I instead issue an HOpen() in the application init procedure and
just leave it open?

Thanks!