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. 3 2386
is your object declared as "shared"...if not that may help also, are you
releasing the synclock after you modify the object's properties?
"Nathan" <np*****@softwaretoolbox.com> wrote in message
news:08****************************@phx.gbl...
| 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.
Hey Steve,
Thanks for the reply.
The object is set as PUBLIC.
I synclock the object, then set its values, then release
the synclock.
The bizarre thing is that when doing this, the properties
do seem to get changed and observed by the timer... but
only the first time this is done, other times results in a
no-change.
Will "shared" be better than "public"? -----Original Message----- is your object declared as "shared"...if not that may
help also, are youreleasing the synclock after you modify the object's
properties?
"Nathan" <np*****@softwaretoolbox.com> wrote in message news:08****************************@phx.gbl... | 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.
.
it should in this case b/c it won't be concerned about the object's
instancing. worth a try anyway before trying other fix tests.
<an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
| Hey Steve,
|
| Thanks for the reply.
|
| The object is set as PUBLIC.
| I synclock the object, then set its values, then release
| the synclock.
|
| The bizarre thing is that when doing this, the properties
| do seem to get changed and observed by the timer... but
| only the first time this is done, other times results in a
| no-change.
|
| Will "shared" be better than "public"?
|
| >-----Original Message-----
| >is your object declared as "shared"...if not that may
| help also, are you
| >releasing the synclock after you modify the object's
| properties?
| >
| >
| >"Nathan" <np*****@softwaretoolbox.com> wrote in message
| >news:08****************************@phx.gbl...
| >| 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.
| >
| >
| >.
| > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David WOO |
last post by:
Hi,
I am a newbie on C++, I need to define some global variables which should be
accessible to most classes. In the mean time, I don't won't the global
variables be modified freely at most of...
|
by: Gianguz |
last post by:
I'd like to discuss about the opportunity to have a global objects
creator that introduces into a general framework
(suited for multithreading) a controlled semantic to manage
globals variables...
|
by: LP |
last post by:
After a code review one coworker insisted that global are very dangerous. He
didn't really give any solid reasons other than, "performance penalties",
"hard to maintain", and "dangerous". I think...
|
by: Trapulo |
last post by:
I've a question about globa variables lifetime in an asp.net app.
I've declared this class:
Public Class Utils
Private Shared _FcdDataManagement As FCD.DataManagement
Public Shared...
|
by: Morpheus |
last post by:
Hello,
Say I have a class with a member...
char mId;
Whenever an object is created, I want to assign an incrementing
character to this member, for instance the first would be A, then B, C,...
| |
by: eoindeb |
last post by:
Sorry to ask another global variable question, but from reading other
posts I'm still not sure whether to use them or not.
I have a program with a set function that calls 4 other functions in...
|
by: CDMAPoster |
last post by:
About a year ago there was a thread about the use of global variables
in A97:
http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157
Best Practices by Kang...
|
by: Sandman |
last post by:
I dont think I understand them. I've read the section on scope in the
manual inside out.
I'm running PHP 5.2.0 Here is the code I'm working on:
//include_me.php
<?php
$MYVAR = array();
global...
|
by: weaknessforcats |
last post by:
C++: The Case Against Global Variables
Summary
This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |