|
-
March 10th, 2009, 04:06 AM
#1
How to syncronize 2 dll's
Hi,
I have 2 dll's in an application. One process, 2 different threads. The 2 dll's are some kind of data sources and they need to start a data cycle at same time. The 3rd dll is a vizualization which has to show up the data. How can I make the 2 data sources start transmiting data at the same time. I tried using 2 mutexes but I end up blocking the entire procees. Can you please guide me to some articles or documentation that could help?
Thank you!
You liked it? Please show your gratitude and rate it!
There is no 'patch' for stupidity.
-
March 10th, 2009, 04:35 AM
#2
Re: How to syncronize 2 dll's
On single cores, there is no "same time". Even though you have multiple threads, they run at different time slots. So when you say "same time" that means most likely "about the same time".
Why don't you explained how you tried to synchronize the two, maybe we can figure what was wrong.
-
March 10th, 2009, 08:02 AM
#3
Re: How to syncronize 2 dll's
so here is what I've done:
1. In Source1 I start Mutex1 and after that I wait for Mutex2
2. In Source2 I wait for Mutex1 and when I got it I start Mutex2.
Here is data source 1:
Code:
m_h_ghMutex1 = CreateMutex(NULL, FALSE, TEXT("SignalGenerator1"));
DWORD dwMutexResult;
do {
m_h_ghMutex2 = OpenMutex(MUTEX_ALL_ACCESS, FALSE, TEXT("SignalGenerator2"));
dwMutexResult = WaitForSingleObject(m_h_ghMutex2, 1000L);
}
while (dwMutexResult != WAIT_OBJECT_0);
//----start sending data----
In data source 2:
Code:
DWORD dwMutexResult;
do {
m_h_ghMutex1 = OpenMutex(MUTEX_ALL_ACCESS, FALSE, TEXT("SignalGenerator1"));
dwMutexResult = WaitForSingleObject(m_h_ghMutex1, 1000L);
} while (dwMutexResult != WAIT_OBJECT_0);
m_h_ghMutex2 = CreateMutex(NULL, FALSE, TEXT("SignalGenerator2"));
//---start sending data---
L.E. I know there is no such thing like "same time" but something unsesizable by human eye would be good enough for me
Last edited by vma; March 10th, 2009 at 08:10 AM.
You liked it? Please show your gratitude and rate it!
There is no 'patch' for stupidity.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|