Click to See Complete Forum and Search --> : How to Thread-safe a dll/function


nkapachi
February 14th, 2006, 12:07 AM
Hi guys,

I am third party application which calls my dll (contains a funtion - This funtion is used for data logging). This function can be called simultaneously and i want to thread-safe it so that i dont loss any data.. Any idea on how can we do this?

Thanks for you help

Nick

Kheun
February 14th, 2006, 12:13 AM
You probably want to put in mutex or critical section in your function.

nkapachi
February 14th, 2006, 12:19 AM
I have never dealt with mutex can you please provide a sample code or something..??

Thanks

Kheun
February 14th, 2006, 12:23 AM
See the links below.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/mutex_objects.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/using_mutex_objects.asp

Marc G
February 14th, 2006, 05:26 AM
[ moved thread ]