StartNotify() and touch command

3 posts / 0 new
Last post
jabirulo
jabirulo's picture
Offline
Last seen: 8 hours 32 min ago
Joined: 2013-05-30 00:53
StartNotify() and touch command

Hi, testing StartNotify() I found that when on a file a do from CLI/Shell "touch " I get 2 notifications, while editing same file and saving I only get one notification-

Attached code, don't know if its ok or has some errors, but works fine.

Using snoopy I can see:
touch rsGUI.cd:
...
00040 : touch : o.k. = SetProtection("RSGUI.cd",0x00000002) [2522uS]
...
00042 : touch : o.k. = SetDate("RSGUI.cd",0x6320E918) [1568uS]
...

notepad rsgui.cd (and use 'Save' from menu):
...
00003 : notepad : o.k. = SetProtection("Devel:SDK/ejemplos/NETWORK/rsGUI/RSGUI.cd",0x00000002) [2959uS]
..

How can I "restrict" to only get (or discard) 1 notification on "touch "?

TiA

File attachments: 

AttachmentSize
File notifysrc.lha773 bytes
cwenzel
cwenzel's picture
Offline
Last seen: 2 weeks 5 days ago
Joined: 2021-01-12 07:05
Re: StartNotify() and touch command

The answer is; Only perform one filesystem action for one notify event.

SetProtection() and SetDate() are two separate actions,
each successful action generates one notify event regardless
of what object it is referencing. That's how it works.

When saving, it appears from that log that it is also SetProtection()'ing
the file too. The meta-data actions send the notifications immediately.
However, operations on a filehandle are deferred until Close()'ed.

If the file was overwritten or a new file created, you should also
get one change/add notification when the file is finally closed.

The reason is that DOS remembers the changed status in the
filehandle that was Open()'ed and when the file is Close()'ed,
it send another notification about the content change.

When using NRF_CALL_HOOK method, and not a message or signal,
you would receive either; NHM_ACTION_ADD or NHM_ACTION_CHANGE
in the nhm_Action field.
Note that NHM_ACTION_ADD overrides NHM_ACTION_CHANGE,
so in other words, an ADD implies a CHANGE, but not the other way around.

jabirulo
jabirulo's picture
Offline
Last seen: 8 hours 32 min ago
Joined: 2013-05-30 00:53
Re: StartNotify() and touch command

THX mate will try the hook mode ASAP.

EDIT1: ok, changed to hook mode and seems what I was looking. THXaLOT

File attachments: 

AttachmentSize
File notify_src02.lha1.08 KB

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonRX550/SSD240GB/DVDRW :-P

Log in or register to post comments