THREAD attribute in multi-dll project 
Author Message
 THREAD attribute in multi-dll project

    Hi all,
I'm just wondering how THREAD attribute is handled in multi-dll project.

I have got global variable exported from data.dll and the variable is used
in several other DLLs or EXEs. It seems to me that it doesn't make sense to
put THREAD attribute to this variable (it is exported!!!).

How would Clarion achieve what it says in documentation?
---
The THREAD attribute declares a variable, FILE, GROUP, QUEUE, or CLASS which
is allocated memory separately for each execution thread in the program.
This makes the values dependent upon which thread is executing.
A threaded variable must be allocated static memory, so Local data with the
THREAD attribute is automatically considered STATIC. This attribute creates
runtime "overhead," particularly on Global or Module data. Therefore, it
should be used only when necessary.
---

It seems to me that I have to remove global variable from data.dll and put
it into another DLL with attribute THREAD (do not export). Then, all
procedures using this variable have to be in this DLL.

Am I right?

    Jaroslav



Fri, 02 Sep 2005 23:13:52 GMT  
 THREAD attribute in multi-dll project
If you need to use this on multiple threads with one value only,
correct.

If you need it to have different values on different threads, thread it.

--

Steve Parker

--------------------------------------------------
kb and download center at:
     www.par2.com
KB: http://www.par2.com/cws/c5launch.dll/FAQS/THEFAQS.exe.0
--------------------------------------------------

"The improbable, we do. The impossible takes a bit longer."


Quote:
>     Hi all,
> I'm just wondering how THREAD attribute is handled in multi-dll project.

> I have got global variable exported from data.dll and the variable is used
> in several other DLLs or EXEs. It seems to me that it doesn't make sense
to
> put THREAD attribute to this variable (it is exported!!!).

> How would Clarion achieve what it says in documentation?
> ---
> The THREAD attribute declares a variable, FILE, GROUP, QUEUE, or CLASS
which
> is allocated memory separately for each execution thread in the program.
> This makes the values dependent upon which thread is executing.
> A threaded variable must be allocated static memory, so Local data with
the
> THREAD attribute is automatically considered STATIC. This attribute
creates
> runtime "overhead," particularly on Global or Module data. Therefore, it
> should be used only when necessary.
> ---

> It seems to me that I have to remove global variable from data.dll and put
> it into another DLL with attribute THREAD (do not export). Then, all
> procedures using this variable have to be in this DLL.

> Am I right?

>     Jaroslav



Sat, 03 Sep 2005 00:32:28 GMT  
 THREAD attribute in multi-dll project
Try perceiving a THREADed variable as one that is passed both the thread
number and the name of the variable when it is referenced in code. Wherever
it is defined it needs to set aside both the space for the variable itself
and the internal handling of storage/retrieval of the other thread's values.
It makes no difference if the variable is exported or not, exporting just
means that other DLLs are able to use this functionality.

Tony Bowes

Quote:
> It seems to me that I have to remove global variable from data.dll and put
> it into another DLL with attribute THREAD (do not export). Then, all
> procedures using this variable have to be in this DLL.

> Am I right?

>     Jaroslav



Sat, 03 Sep 2005 09:08:07 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Attribute support and multi-threading for Pyro

2. Global variables in Multi DLL project

3. Multi-threaded / multi-processor CL ?

4. Multi-threading on Multi-CPU machines

5. How to develop multi dll and multi dictionary application

6. Multi DLL Multi DCT problem

7. multi DLLs, multi DCTs

8. Multi DLL & Multi DCT

9. multi-attribute measures

10. Looking for a multi-column listbox with cell color attribute

11. Multi Document Project

12. Managing multi-programmer projects in OOP.

 

 
Powered by phpBB® Forum Software