How can I get a unique thread identifier?

Shepmaster

In an attempt to build an "emulated" Reentrant mutex, I need an identifier that is unique to each thread. I can get the current thread via thread::current, but Thread doesn't seem to have anything that could be used (or abused) as an identifier.

For my purposes, I believe the identifier can be reused once a thread exits, although I would be also interested in answers that didn't reuse identifiers as those may be useful in other cases.

Shepmaster

but Thread doesn't seem to have anything that could be used (or abused) as an identifier.

This was rectified in Rust 1.19 via Thread::id.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Get a unique identifier of an object

分類Dev

How can I filter django queryset again to get unique parameters?

分類Dev

How can I get unique words from a DataFrame column of strings?

分類Dev

How can I get the last line number of unique commands when grepping my history file?

分類Dev

How do we get the macid or any other unique identifier in php for the login system

分類Dev

SQL: How do I combine tables on a single but non-unique identifier?

分類Dev

How can I become thread safe?

分類Dev

Can I get RabbitMQ to have a unique constraint on tasks?

分類Dev

How can i get sectionid

分類Dev

How can I generate an unique id in Symfony 4?

分類Dev

How can I split a list in two unique lists in Python?

分類Dev

How can I use unique_ptr with a more generic deleter?

分類Dev

How do I get the earliest record by date for a unique constraint?

分類Dev

How can I call interface callback on its caller thread?

分類Dev

How can I make this code thread-safe

分類Dev

How can I refactor this code into multi-thread version?

分類Dev

how can I make thread in TCP server multi client dialogue

分類Dev

How can I pass a Swift array as an argument to a thread?

分類Dev

Unique identifier for Racket objects?

分類Dev

tvOS unique device identifier

分類Dev

How can an identifier be both already declared and not defined?

分類Dev

JavaFX - Thread hangs, and I can't figure out how to run my loop outside the UI thread

分類Dev

How to get this thread to work?

分類Dev

how can I get nth digit in a BigInteger?

分類Dev

How can I get Mockito working in androidTest

分類Dev

How can I get the number of enums as a constant?

分類Dev

How can I get a renderer in a-frame

分類Dev

How can I get last segment of the string?

分類Dev

How can I get array of UIStoryboard in Swift?

Related 関連記事

  1. 1

    Get a unique identifier of an object

  2. 2

    How can I filter django queryset again to get unique parameters?

  3. 3

    How can I get unique words from a DataFrame column of strings?

  4. 4

    How can I get the last line number of unique commands when grepping my history file?

  5. 5

    How do we get the macid or any other unique identifier in php for the login system

  6. 6

    SQL: How do I combine tables on a single but non-unique identifier?

  7. 7

    How can I become thread safe?

  8. 8

    Can I get RabbitMQ to have a unique constraint on tasks?

  9. 9

    How can i get sectionid

  10. 10

    How can I generate an unique id in Symfony 4?

  11. 11

    How can I split a list in two unique lists in Python?

  12. 12

    How can I use unique_ptr with a more generic deleter?

  13. 13

    How do I get the earliest record by date for a unique constraint?

  14. 14

    How can I call interface callback on its caller thread?

  15. 15

    How can I make this code thread-safe

  16. 16

    How can I refactor this code into multi-thread version?

  17. 17

    how can I make thread in TCP server multi client dialogue

  18. 18

    How can I pass a Swift array as an argument to a thread?

  19. 19

    Unique identifier for Racket objects?

  20. 20

    tvOS unique device identifier

  21. 21

    How can an identifier be both already declared and not defined?

  22. 22

    JavaFX - Thread hangs, and I can't figure out how to run my loop outside the UI thread

  23. 23

    How to get this thread to work?

  24. 24

    how can I get nth digit in a BigInteger?

  25. 25

    How can I get Mockito working in androidTest

  26. 26

    How can I get the number of enums as a constant?

  27. 27

    How can I get a renderer in a-frame

  28. 28

    How can I get last segment of the string?

  29. 29

    How can I get array of UIStoryboard in Swift?

ホットタグ

アーカイブ