11-11-2019 12:42 PM - edited 11-18-2019 11:48 AM
I have an application that makes numerous GeoMedia connections on the UI thread. I then have another thread where I want to access some of this information. A call to any of the GeoMedia connections on the new thread causes the error below.
The only way I can get this to work is by Invoking the call back on to the main thread.
Is it possible to call a GeoMedia function on a thread other than the one it was created on?
I read that this might be possible in GM2016.2 patch 3. Is that the case?
Many thanks for your help!
Solved! Go to Solution.
11-11-2019 01:30 PM
most of the GeoMedia COM objects (including Connection) are not thread safe. So indeed the only way to call them is from the application main thread, or more precisely, from the thread which handles the application message loop. If you want to access for example the same database from different threads, then you can create two or more executables and let them communicate each other via an inter process communication mechanism, such as DDE.
11-11-2019 01:33 PM
I am not sure, I understood correctly what you want to do.
You can call GeoMedia commands using the Windows API function PostMessage.
But when I look at your error message, I think it's not a problem with thread crossing.
I guess there is a problem with the value of Object Geometry. Is this a blob value (not a GDO geometry object) in your case?
It may work, if you use the GeometryToStorage method instead of SetGeometry and set the GField to the outputed chunk of this method.