Read with query condition - .Net thread safety

2 posts / 0 new
Last post
Offline
Last seen: 8 years 11 months ago
Joined: 07/30/2015
Posts: 2
Read with query condition - .Net thread safety

I am using the C# .Net API for RTI Community DDS.

I am trying to query DDS on demand using a QueryCondition and read_w_condition() on a typed DataReader. I am trying to use the DataReader to access or take data I have previously published on demand from the application so that I can use DDS as a store of data. I am using multiple threads as I am servicing multiple interfaces.

I have found that dataReader.create_querycondition() fails and returns null if it is called from a different thread to the one that the dataReader was created on. If the DataReader and QueryCondition are created on the same thread the condition will be correctly created, but when they are used together with read_w_condition() the function with throw an exception, unless it is called from the same thread. I have been unable to find mention of these restrictions in the documentation. Does anyone have any idea of the scope of these restrictions?

Offline
Last seen: 8 years 11 months ago
Joined: 07/30/2015
Posts: 2

I am not sure if this is a complete answer, but I was probably falling foul of the Exclusive Area rules in at least on of the configurations I tested. I was trying to create the QueryCondition from a thread that was created by a different DataListener for handling on_data_available. Aparently this is not permitted without a special QOS setting being enabled as explained by the following links: 

http://community.rti.com/docs/html/api_dotnet/classDDS_1_1Listener.html#SharedEACallbackRules
http://community.rti.com/docs/html/api_dotnet/structDDS_1_1ExclusiveAreaQosPolicy.html

For now I have changed my approach to avoid the need read data on demand, so am not being affected by this issue at the moment. I think one of the configurations I tested while trying to understand this behaviour would not have been breaking the EA rules, but I am not sure without trying to replicate it. If I see it again in a sitation where I am not breaking the EA rules I will post a follow up.