FindFirstChangeNotification. WaitForMultipleObjects recommended approach?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FindFirstChangeNotification. WaitForMultipleObjects recommended approach?

rush
Hi,

I would like to monitor certain set of files that are used by my app, and if
they get changed by some external means load them again into the app.

As far as I understod, general approach to those things is to create change
notification object with FindFirstChangeNotification call, and then perform
WaitForMultipleObjects call on that object.

However as far as I understand this could block the smalltalk process which
I certanly do not want to do. So how should one approach this? Things
comming to my mind are:

a) writing some C code, that runs on separate thread, and wraps necessary
calls into more Dolphin friendly form - [hate to do that, not sure how, have
to find C compiler]
b) try to piggyback somewhere in InputState>>idleXYZ [do not not know how,
not sure that it could work].
c) some other way?

Thanks for any help or advice

rush


Reply | Threaded
Open this post in threaded view
|

Re: FindFirstChangeNotification. WaitForMultipleObjects recommended approach?

Steve Waring-2
Hi Rush,

"rush" <[hidden email]> wrote in message
news:ak86d8$184g$[hidden email]...
> Hi,
>
> I would like to monitor certain set of files that are used by my app, and
if
> they get changed by some external means load them again into the app.
>
> As far as I understod, general approach to those things is to create
change
> notification object with FindFirstChangeNotification call, and then
perform
> WaitForMultipleObjects call on that object.
>
> However as far as I understand this could block the smalltalk process
which
> I certanly do not want to do. So how should one approach this? Things
> comming to my mind are:

I needed to do this for an old project. The approach I took was to have a
class that forked a background process that blocked on the the #wait*
function, and then triggered an event in the main process using
SessionManager inputState queueDeferredAction: [ ... ]. I used a second
event handle that I could set myself, in order to shut down the process.

FWIW: Louis Sumberg and I did some work on the WindowsShell a couple of
months ago. It includes a couple of classes that listen for change
Notifications from the Shell as described at:

    http://www.geocities.com/SiliconValley/4942/notify.html

I have used this technique for a couple of projects since and it has worked
well. We should be releasing that code real soon now, but if you want to
take a look, email me and I will send it through.

Thanks,
Steve

==========
Steve Waring
[hidden email]
http://www.dolphinharbor.org/dh/harbor/steve.html


Reply | Threaded
Open this post in threaded view
|

Re: FindFirstChangeNotification. WaitForMultipleObjects recommended approach?

rush
"Steve Waring" <[hidden email]> wrote in message
news:b4_99.16096$[hidden email]...
> I needed to do this for an old project. The approach I took was to have a
> class that forked a background process that blocked on the the #wait*
> function, and then triggered an event in the main process using
> SessionManager inputState queueDeferredAction: [ ... ]. I used a second
> event handle that I could set myself, in order to shut down the process.

when you say "background process" you mean Smalltalk process? I was worried
that if I call wait for multiple objects in any Smalltalk process, all
smalltalk processes would stop. Anaway, I have probable forgotten about the
overlapped calls, probably if I make WaitForMultipleObjects overlapped that
would make things work.

Thanks!

rush


Reply | Threaded
Open this post in threaded view
|

Re: FindFirstChangeNotification. WaitForMultipleObjects recommended approach?

Steve Alan Waring
Hi rush,

> when you say "background process" you mean Smalltalk process?

Yes.

> overlapped calls, probably if I make WaitForMultipleObjects
> overlapped that would make things work.

Yes, sorry for not being clear, I did use an overlapped call for this
function, which only blocked the background process.

Steve
==========
Steve Waring
[hidden email]
http://www.dolphinharbor.org/dh/harbor/steve.html