DevOpen, doesn´t open in shared mode?

Hi!

I have a device created, dBASE_DEV, that creates an DBF.

I then call this device from a number of functions primarily using DevOpen in mode 0. Defined as mode 0, not relying on default 0.
This works fine when one function at a time opens the device, does it's thing, and then closes it.

But when I then have a loop that opens the device and each 10seconds scans through it just reading what´s in it, not closing it while sleeping. That function crashes when an other function opens the device.

It sounds like mode 0, shared mode, wouldn´t cause this. But Iv´e also tried mode 16, read only. But I get the same result with it crashing.
If I debug I get the error for bad handle, so I guess that the mode isn't as shared as one would think..

Am I using the device wrong? Maybe it can´t be opened from more than one function at a time?

Parents
  • Hi Anders,

    If you call DevOpen repeatedly from within your loop code, you will get a handle leak and eventually you will be out of handles and/or memory.
    You will have to decide if you want to open your device once (before the loop starts) and keep it open the whole time, or if you want to open and close it each time from within the loop.

    Regards,
    Patrick
Reply
  • Hi Anders,

    If you call DevOpen repeatedly from within your loop code, you will get a handle leak and eventually you will be out of handles and/or memory.
    You will have to decide if you want to open your device once (before the loop starts) and keep it open the whole time, or if you want to open and close it each time from within the loop.

    Regards,
    Patrick
Children
No Data