public inbox for
 help / color / mirror / Atom feed
From: Markus Forrer <>
Subject: isCurrentThread()
Date: Sat, 3 Apr 2021 10:16:25 +0200	[thread overview]
Message-ID: <trinity-659b4c47-b554-482f-905c-665e8be6bbb1-1617437785049@3c-app-gmx-bs35> (raw)

I have implemented a method in my thread class Win32Thread to find out if it is the current thread:

bool Win32Thread::isCurrentThread() const
    pthread_t currentThread = pthread_self();

    return pthread_equal(currentThread, mThread) != 0;

Unfortunately, this implementation does not work. The function pthread_self() gets the current win32 threadId with GetCurrentThreadId(). But how do I have to check in my method isCurrentThread() if the current instance of Win32Thread is the current thread? I have not found an alternative to pthread_equal() in the PThread Api.

Thanks for any hints


             reply	other threads:[~2021-04-03  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-03  8:16 Markus Forrer [this message]
2021-04-03 22:15 ` isCurrentThread() ross.johnson
2021-04-08  4:43   ` isCurrentThread() Markus Forrer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-659b4c47-b554-482f-905c-665e8be6bbb1-1617437785049@3c-app-gmx-bs35 \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).