Commit a2a17a1b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Use pthread_equal(3) as POSIX intended.

Spotted by: Rasmus Villemoes
parent 30eb7db8
......@@ -591,7 +591,7 @@ void BAN_Abandon(struct ban_proto *b);
/* cache_cli.c [CLI] */
extern pthread_t cli_thread;
#define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0)
#define ASSERT_CLI() do {assert(pthread_equal(pthread_self(), cli_thread));} while (0)
/* cache_http.c */
unsigned HTTP_estimate(unsigned nhttp);
......
......@@ -77,7 +77,7 @@ barrier_new(const char *name, struct vtclog *vl)
ALLOC_OBJ(b, BARRIER_MAGIC);
AN(b);
if (pthread_self() != vtc_thread)
if (!pthread_equal(pthread_self(), vtc_thread))
vtc_fatal(vl,
"Barrier %s can only be created on the top thread", name);
REPLACE(b->name, name);
......
......@@ -114,7 +114,7 @@ vtc_logfail(void)
{
vtc_error = 2;
if (pthread_self() != vtc_thread)
if (!pthread_equal(pthread_self(), vtc_thread))
pthread_exit(NULL);
else
exit(fail_out());
......
......@@ -221,7 +221,7 @@ VEV_Destroy(struct vev_root **evbp)
struct vev_root *evb;
TAKE_OBJ_NOTNULL(evb, evbp, VEV_BASE_MAGIC);
assert(evb->thread == pthread_self());
assert(pthread_equal(evb->thread, pthread_self()));
free(evb->pfd);
free(evb->pev);
/* XXX: destroy evb->binheap */
......@@ -255,7 +255,7 @@ VEV_Start(struct vev_root *evb, struct vev *e)
assert(e->sig >= 0);
assert(e->timeout >= 0.0);
assert(e->fd < 0 || e->fd_flags);
assert(evb->thread == pthread_self());
assert(pthread_equal(evb->thread, pthread_self()));
DBG(evb, "ev_add(%p) fd = %d\n", e, e->fd);
if (vev_get_pfd(evb))
......@@ -311,7 +311,7 @@ VEV_Stop(struct vev_root *evb, struct vev *e)
CHECK_OBJ_NOTNULL(e, VEV_MAGIC);
DBG(evb, "ev_del(%p) fd = %d i=%u L=%d\n", e, e->fd, e->__binheap_idx, evb->lpfd);
assert(evb == e->__vevb);
assert(evb->thread == pthread_self());
assert(pthread_equal(evb->thread, pthread_self()));
assert(evb->pev[e->__binheap_idx] == e);
assert(e->__binheap_idx != VBH_NOIDX);
......@@ -344,7 +344,7 @@ VEV_Loop(struct vev_root *evb)
int i;
CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC);
assert(evb->thread == pthread_self());
assert(pthread_equal(evb->thread, pthread_self()));
do
i = VEV_Once(evb);
while (i == 1);
......@@ -406,7 +406,7 @@ VEV_Once(struct vev_root *evb)
unsigned u;
CHECK_OBJ_NOTNULL(evb, VEV_BASE_MAGIC);
assert(evb->thread == pthread_self());
assert(pthread_equal(evb->thread, pthread_self()));
assert(evb->lpfd < evb->npfd);
if (evb->psig)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment