# Semaphore with permit id?

**URL:** https://discourse.julialang.org/t/semaphore-with-permit-id/82142
**Category:** Performance
**Tags:** multithreading, threads
**Created:** [June 2, 2022, 3:34pm UTC](https://discourse.julialang.org/t/semaphore-with-permit-id/82142 "2022-06-02T15:34:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Joris\_Pinkse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joris_pinkse/32/216398_2.png) [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)
#### Post date: [June 2, 2022, 3:34pm UTC](https://discourse.julialang.org/t/semaphore-with-permit-id/82142/1 "2022-06-02T15:34:24Z")

</div>

I’d like to use a Semaphore like object with say four permits, where a call to acquire would tell me which of the four permits was assigned and a call to release would release that specific permit. I understand that Semaphore just keeps a tally. What would be the easiest way of achieving this, preferably without using any third party packages? Thanks!!

---

<div class="post-metadata">

### Author: ![Joris\_Pinkse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joris_pinkse/32/216398_2.png) [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)
#### Post date: [June 7, 2022, 2:50am UTC](https://discourse.julialang.org/t/semaphore-with-permit-id/82142/2 "2022-06-07T02:50:44Z")

</div>

Well, there is now. See [https://github.com/NittanyLion/Smartphores.jl](https://github.com/NittanyLion/Smartphores.jl)
