Home
Reply
Contributor
androy
Posts: 8

Using ACIS in Multithreaded Applications

What kind of initialization is required to be performed in each new thread of the multithreaded application, which uses ACIS functionality?

 

I'm trying to implement the process which is performed in a separate thread, different from the thread in which the application GUI is working.

New thread is created with AfxBeginThread function. Everything is fine until I start calling any ACIS functions. I tried to make initialization in this thread just in the same way as is implemented in the main thread, but it still crashes as soon as I call any ACIS function.

I know about the ACIS thread manager, but in my case I don't want to use it.

Spatial Employee
RTadlock
Posts: 40

Re: Using ACIS in Multithreaded Applications

Hi Androy,

 

It sounds like you are not actually trying to run any ACIS functions in a multi-threaded way, but rather trying to keep from starving your GUI thread, and thus keep your GUI responsive.  Is this correct?  If you are indeed not trying to run anything multi threaded, then you can start ACIS in your main thread, and then just spawn off any specific ACIS functions in a separate thread.  It sounds like that may be what you are currently doing, but I don't want to assume.  Is there anyway, you can send me more detailed information about your crash?  Say an error message or something?  Some sample/pseudo code may also help.  Lastly, you can take a look at the following document regarding thread safe ACIS initialization (with the ACIS thread manager of course): http://doc.spatial.com/index.php/Thread-Safe_ACIS 

 

It sounds like you don't need to use thread safe ACIS, however, so the above document is probably not what you're looking for.  Please provide the extra info, for me, and I'll be glad to take another look.

 

- - Robert

Spatial Employee
Jeff
Posts: 38

Re: Using ACIS in Multithreaded Applications

Hi Androy

 

Try surrounding the ACIS calls your worker thread makes with the ACIS functions: thread_safe_region_begin and thread_safe_region_end.  These are required when you have concurrency in ACIS and are not using our thread manager.

 

Jeff

Contributor
androy
Posts: 8

Re: Using ACIS in Multithreaded Applications

Hi Jeff,

 

Thank you for information.

Even if I surround code in thread_safe_region_begin and thread_safe_region_end I still get crash.

I should make one important adjustment to the explanation of the problem. We are using ACIS thread manager, but to make GUI respond on user actions we are starting the thread manager from the thread created by Windows API AfxBeginThread function. And the program crashes not in this thread, but in the 'process' function of the thread_work_base derived class.

 

May be now it will be more clear for you why it crashes.

 

Andrey

 

Contributor
androy
Posts: 8

Re: Using ACIS in Multithreaded Applications

In order to make it more clear I have prepared a sample VS2008 project that does similar task.

Please find it attached.

 

Thank you.

Andrey

Spatial Moderator
ybiyani
Posts: 223

Re: Using ACIS in Multithreaded Applications

Hello Androy,

 

Can you please create an incident in the online support center with the example for further review?

 

Regards,

Yogesh

Contributor
androy
Posts: 8

Re: Using ACIS in Multithreaded Applications

Hello Yogesh,

 

This problem has been already registered in the online support center. The incident reference number is 100531-000004.

It was almost one week ago, but we have not received any answer.

 

Regards,

Andrey

 

 

Spatial Moderator
ybiyani
Posts: 223

Re: Using ACIS in Multithreaded Applications

Hello Andrey,

 

I checked the incident and I see that Aditya (ACIS developer) replied on 2nd June (within 3 days). From what I understand this issue is a bit involved so it will take some time to address.

 

Regards,

Yogesh