# What is the difference between \`Threads.@threads' and \`Threads@threads'?

**URL:** <https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558>\
**Category:** General Usage\
**Tags:** parallel, multithreading\
**Created:** [December 6, 2017, 9:10am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558 "2017-12-06T09:10:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alirezamecheng](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@alirezamecheng](https://discourse.julialang.org/u/alirezamecheng)\
**Post date:** [December 6, 2017, 9:10am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/1 "2017-12-06T09:10:21Z")

</div>

Hello.  
I’m wondering what is the difference between `Threads.@threads` and `Threads@threads`?  
for example in :

```julia
Threads.@threads for i=1:N
            A[i] = i
        end

```

Thank you.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 6, 2017, 9:13am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/2 "2017-12-06T09:13:52Z")

</div>

Where have you seen `Threads@threads`, without the dot?

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [December 6, 2017, 9:16am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/3 "2017-12-06T09:16:27Z")

</div>

Please comment your code properly using ```, see [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

---

<div class="post-metadata">

**Author:** ![alirezamecheng](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@alirezamecheng](https://discourse.julialang.org/u/alirezamecheng)\
**Post date:** [December 6, 2017, 9:36am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/4 "2017-12-06T09:36:07Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![alirezamecheng](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@alirezamecheng](https://discourse.julialang.org/u/alirezamecheng)\
**Post date:** [December 6, 2017, 9:37am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/5 "2017-12-06T09:37:45Z")

</div>

Can you tell me What this dot means?  
I have seen it in someone’s code on the internet.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 6, 2017, 9:49am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/6 "2017-12-06T09:49:58Z")

</div>

The macro `@threads` (macros are identified by the leading at-sign) is defined inside the `Threads` module, but it’s not exported. Thus, in order to call it, you have use the syntax `module.function`, with the dot between the module’s name and the function’s name. You’ll find more in the manual: [https://docs.julialang.org/en/stable/manual/modules](https://docs.julialang.org/en/stable/manual/modules).

In addition, note that `Threads@threads` is parsed as:

```julia
Threads * @threads

```

that is, multiplication between a module name and a non-existent macro (because it’s not exported).

---

<div class="post-metadata">

**Author:** ![alirezamecheng](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@alirezamecheng](https://discourse.julialang.org/u/alirezamecheng)\
**Post date:** [December 6, 2017, 10:36am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-threads-threads-and-threads-threads/7558/7 "2017-12-06T10:36:20Z")

</div>

Thank you.
