Message 1 of 13
Multi-threading question
Not applicable
08-10-2005
10:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've got a database that I access through C# web services. I need to update
an AutoCAD drawing if anything in that database changes. I've created a
thread that regularly asks the database if there is anything new. If there
is, I'd like to somehow make some changes in AutoCAD. Is this possible?
Can I trigger an event in AutoCAD from a seperate thread?
Here's how I make the thread:
[CommandMethod("StartPollingForEvents")]
public static void StartPollingForEvents()
{
// Define the thread's target method
PollingManager pollingManager = new PollingManager();
Thread t = new Thread(new ThreadStart
(pollingManager.ExecuteThread));
// Start the thread
t.Start();
t.Abort();
while (!t.IsAlive);
Thread.Sleep(100);
t.Join();
}
Here's the thread's target method:
public void ExecuteThread()
{
CommandLinePrompts.Message("\n ExecuteThread method entered.");
while(true)
{
CommandLinePrompts.Message("\n Output from thread...");
}
}
I get no output to the command line when I run this code.
Thanks very much for any help or ideas.
-Carlos
I've got a database that I access through C# web services. I need to update
an AutoCAD drawing if anything in that database changes. I've created a
thread that regularly asks the database if there is anything new. If there
is, I'd like to somehow make some changes in AutoCAD. Is this possible?
Can I trigger an event in AutoCAD from a seperate thread?
Here's how I make the thread:
[CommandMethod("StartPollingForEvents")]
public static void StartPollingForEvents()
{
// Define the thread's target method
PollingManager pollingManager = new PollingManager();
Thread t = new Thread(new ThreadStart
(pollingManager.ExecuteThread));
// Start the thread
t.Start();
t.Abort();
while (!t.IsAlive);
Thread.Sleep(100);
t.Join();
}
Here's the thread's target method:
public void ExecuteThread()
{
CommandLinePrompts.Message("\n ExecuteThread method entered.");
while(true)
{
CommandLinePrompts.Message("\n Output from thread...");
}
}
I get no output to the command line when I run this code.
Thanks very much for any help or ideas.
-Carlos