Question: Suppose I have following html code.

```
<div>
    <label>Test1</label>
    <input type="file">
    <a href="#" class="selected-file"></a>
</div>
<div>
    <label>Test2</label>
    <input type="file">
    <a href="#" class="selected-file"></a>
</div>
<div>
    <label>Test3</label>
    <input type="file">
    <a href="#" class="selected-file"></a>
</div>

```

What I need is that, if someone changes/selects a file then the nearest `<a>` should hide. I tried to do something like this below 

```
$(function() {
    $("input:file").change(function (){
        $(this).closest(".selected-file").hide()
    });
});

```

But this doesn't hide the `<a>` tag. How can I make this work?

Answer: 
It's a side-effect of a glibc feature, fixed in <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57060>:

```
// For the GNU C library pthread_self() is usable without linking to
// libpthread.so but returns 0, so we cannot use it in single-threaded
// programs, because this_thread::get_id() != thread::id{} must be true.

```

If you explicitly link against pthreads (`-pthread` or `-lpthread`) then your program will behave as expected.

Oddly enough, on my system, adding a call to `pthread_self` (before or after the call to `std::this_thread::get_id()` does not change behavior:

```
0
thread::id of a non-executing thread

```

This may be an Ubuntu-specific behavior, linking pthreads automatically if `pthread_self` is called, but it seems a bit odd. Note that `std::this_thread::get_id()` calls `pthread_self` via a weak reference (itself via `__gthread_self`).
Standard does not actually define what the `this_thread::get_id` is going to return. All it says is:

> 
> Returns: An object of type thread::id that **uniquely identifies the
>  current thread of execution. No other thread of execution shall have
>  this id and this thread of execution shall always have this id**. The
>  object returned shall not compare equal to a default constructed
>  thread::id.
> 
> 
> 

This condition is met with your output, so everything is in order.

By the way, do not confuse `thread_id` returned by `this_thread::get_id` with numerical thread id returned by `std::thread::get_id()`. `thread_id` main usage is to be compared and used in associative containers, not directly introspected or printed.