N
Nathan
Somebody help please, I am desperate for help as I've
battled this problem for 3 days now!
I have an application (NT Service) that uses 2 threads...
one worker-thread (i.e. always running) and a 2nd thread
that is used to display a gui (NT service runs with
desktop interaction) on demand, i.e. from a Notify icon in
the toolbar.
I have an object, which uses a Timer
(system.timers.timer). I have a collection of these
objects globally defined.
My application is connected to a data-server which is
always sending data to me. For this reason, my worker-
thread must always be running, and I cannot drop the
connection to the server that is supplying me the data -
not even for 1 msec.
The problem I am having is that in some situations, a user
of my application may need to change the properties of my
objects.. they may need to change the timer to tick every
500msec or every 100msec for example. So my GUI thread
shows a property screen, and then sets the global object
properties to equal those defined within the screen, once
the screen is closed+validated.
When stepping through the application (debug mode) I can
see the global variable has indeed been changed, but when
I step through the timer.elapsed event (which is supposed
to be running in the worker-thread) I can see that the
properties of myself (the global object that contains this
timer) does not reflect the new settings.
I have placed breakpoints on my objects NEW constructors,
and they never fire... so I know I am now duplicating the
objects in memory.
The Timer seems to use its own thread regardless, and I
think this is where the problem lies. I think that there
is a mutexing problem which is causing my problems.
I have placed a Synclock on the global object while I
change the properties of it, after the user has closed the
properties screen... this DOES help, but only once! i.e.
if you change the timer setting from 100msec to 500msec,
this is reflected the first time, but subsequent attempts
at changing the properties do not get reflected. This is
the same code being executed, and there are no counters or
IF..THEN statements that would cancel out the properties
being set, because I can see them change when stepping
through the application.
If I re-open the properties window of the object, I do see
the correct object values.
When stepping through the timer, the properties of "me"
differ from what they should be.
Has anybody seen this? does anybody know what the problem
might be? Any help would be truly welcomed.
battled this problem for 3 days now!
I have an application (NT Service) that uses 2 threads...
one worker-thread (i.e. always running) and a 2nd thread
that is used to display a gui (NT service runs with
desktop interaction) on demand, i.e. from a Notify icon in
the toolbar.
I have an object, which uses a Timer
(system.timers.timer). I have a collection of these
objects globally defined.
My application is connected to a data-server which is
always sending data to me. For this reason, my worker-
thread must always be running, and I cannot drop the
connection to the server that is supplying me the data -
not even for 1 msec.
The problem I am having is that in some situations, a user
of my application may need to change the properties of my
objects.. they may need to change the timer to tick every
500msec or every 100msec for example. So my GUI thread
shows a property screen, and then sets the global object
properties to equal those defined within the screen, once
the screen is closed+validated.
When stepping through the application (debug mode) I can
see the global variable has indeed been changed, but when
I step through the timer.elapsed event (which is supposed
to be running in the worker-thread) I can see that the
properties of myself (the global object that contains this
timer) does not reflect the new settings.
I have placed breakpoints on my objects NEW constructors,
and they never fire... so I know I am now duplicating the
objects in memory.
The Timer seems to use its own thread regardless, and I
think this is where the problem lies. I think that there
is a mutexing problem which is causing my problems.
I have placed a Synclock on the global object while I
change the properties of it, after the user has closed the
properties screen... this DOES help, but only once! i.e.
if you change the timer setting from 100msec to 500msec,
this is reflected the first time, but subsequent attempts
at changing the properties do not get reflected. This is
the same code being executed, and there are no counters or
IF..THEN statements that would cancel out the properties
being set, because I can see them change when stepping
through the application.
If I re-open the properties window of the object, I do see
the correct object values.
When stepping through the timer, the properties of "me"
differ from what they should be.
Has anybody seen this? does anybody know what the problem
might be? Any help would be truly welcomed.