473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Threading Problem

I have a typical scenario to work with and seeking help for the same.
The scenario is.

1) I have to write some code in Managed C++ and C# code.
2) Managed C++ will interact with Native windows service.

Detailed Information
C++ Dll
When the native windows service start, it calls its own callback Init (
) method in our C++ dll (coz these methods are exported from this dll).
Further, there is another exported method Query( ) is there, which
receives a query from windows Service and passes it for resolution in
C# dll.

C#Dll

This has two functionality : 1) Continuous Polling 2) Resolve queries
received from C++dll then after resolution passed to C++ dll which will
further pass it to Service.

Problem

I want to implement continous polling using thread more specifically
using TimerDelegate but no sucess. Although where should i spawn this
delegate in C++ or in C# dll.

May 16 '06 #1
2 1467
Anshul,

The real problem is that you want to use continuous polling. In most
cases, it is better to use an event notification than to poll. You are just
wasting resources by polling.

It sounds like the C# dll will be hosted outside of the service (hence
the need for the polling, perhaps)? If this is the case, why not use
something like MSMQ to send messages between the two. That way, you don't
have to have some process cycling in a tight loop wasting processor time
just waiting for a message.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Anshul" <an************@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
I have a typical scenario to work with and seeking help for the same.
The scenario is.

1) I have to write some code in Managed C++ and C# code.
2) Managed C++ will interact with Native windows service.

Detailed Information
C++ Dll
When the native windows service start, it calls its own callback Init (
) method in our C++ dll (coz these methods are exported from this dll).
Further, there is another exported method Query( ) is there, which
receives a query from windows Service and passes it for resolution in
C# dll.

C#Dll

This has two functionality : 1) Continuous Polling 2) Resolve queries
received from C++dll then after resolution passed to C++ dll which will
further pass it to Service.

Problem

I want to implement continous polling using thread more specifically
using TimerDelegate but no sucess. Although where should i spawn this
delegate in C++ or in C# dll.

May 16 '06 #2
Hi,
Thanks for your reply.
I agree we could have implemented MSMQ however, regarding continuous
polling. Is there any way to have the control on thread.
Like:
Init()
{
Initiate the thread .....
} // When it comes here thread will be terminated

Is there any way through which the scope should remain and stop only
when native service unloads the dll.

Thanks
Anshul

Nicholas Paldino [.NET/C# MVP] wrote:
Anshul,

The real problem is that you want to use continuous polling. In most
cases, it is better to use an event notification than to poll. You are just
wasting resources by polling.

It sounds like the C# dll will be hosted outside of the service (hence
the need for the polling, perhaps)? If this is the case, why not use
something like MSMQ to send messages between the two. That way, you don't
have to have some process cycling in a tight loop wasting processor time
just waiting for a message.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Anshul" <an************@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
I have a typical scenario to work with and seeking help for the same.
The scenario is.

1) I have to write some code in Managed C++ and C# code.
2) Managed C++ will interact with Native windows service.

Detailed Information
C++ Dll
When the native windows service start, it calls its own callback Init (
) method in our C++ dll (coz these methods are exported from this dll).
Further, there is another exported method Query( ) is there, which
receives a query from windows Service and passes it for resolution in
C# dll.

C#Dll

This has two functionality : 1) Continuous Polling 2) Resolve queries
received from C++dll then after resolution passed to C++ dll which will
further pass it to Service.

Problem

I want to implement continous polling using thread more specifically
using TimerDelegate but no sucess. Although where should i spawn this
delegate in C++ or in C# dll.


May 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
19
by: Jane Austine | last post by:
As far as I know python's threading module models after Java's. However, I can't find something equivalent to Java's interrupt and isInterrupted methods, along with InterruptedException....
17
by: Andrae Muys | last post by:
Found myself needing serialised access to a shared generator from multiple threads. Came up with the following def serialise(gen): lock = threading.Lock() while 1: lock.acquire() try: next...
2
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
11
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
9
by: cgwalters | last post by:
Hi, I've recently been working on an application which does quite a bit of searching through large data structures and string matching, and I was thinking that it would help to put some of this...
5
by: CCLeasing | last post by:
For an application I'm creating I want to create a 'fake' progress bar. By fake I mean a progress bar that looks like it's doing something but actually isn't. I know philosophically this isn't...
126
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.