pike.git/
src/
threads.c
Branch:
Tag:
Non-build tags
All tags
No tags
1998-03-01
1998-03-01 03:33:50 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
d213275f9a14e5f311453980d9215a548402e419 (
18
lines) (+
12
/-
6
)
[
Show
|
Annotate
]
Branch:
7.9
new thread stuff: th_hash & th_equal
Rev: src/threads.c:1.58
Rev: src/threads.h:1.33
1:
#include "global.h"
-
RCSID("$Id: threads.c,v 1.
57
1998/
02
/
27
20
:
09
:
04
marcus
Exp $");
+
RCSID("$Id: threads.c,v 1.
58
1998/
03
/
01
03
:
33
:
50
hubbe
Exp $");
int num_threads = 1; int threads_disabled = 0;
168:
unsigned INT32 thread_table_hash(THREAD_T *tid) {
-
return
hashmem
(
(unsigned char
*
)
tid
, sizeof(*tid
)
,
16)
% THREAD_TABLE_SIZE;
+
return
th_hash
(*tid) % THREAD_TABLE_SIZE;
} void thread_table_insert(struct object *o)
198:
unsigned INT32 h = thread_table_hash(&tid); struct thread_state *s = NULL; mt_lock( & thread_table_lock );
-
if(thread_table_chains[h] == NULL) {
+
if(thread_table_chains[h] == NULL)
+
{
/* NULL result */
-
} else if((s=thread_table_chains[h])->id
==
tid) {
+
}
+
else if(
th_equal
(
(
s=thread_table_chains[h])->id
,
tid)
)
+
{
/* Quick return */
-
} else {
+
}
+
else
+
{
while((s = s->hashlink) != NULL)
-
if(s->id
==
tid)
+
if(
th_equal(
s->id
,
tid)
)
break; if(s != NULL) { /* Move the thread_state to the head of the chain, in case