blob: 5e5e3d6e584af3cff728798104ecdb132048f835 [file] [log] [blame]
Alexandre Julliard642d3131998-07-12 19:29:36 +00001/*
2 * Server-side thread management
3 *
4 * Copyright (C) 1998 Alexandre Julliard
5 */
6
7#include <assert.h>
8#include <fcntl.h>
Alexandre Julliard767e6f61998-08-09 12:47:43 +00009#include <signal.h>
Alexandre Julliard642d3131998-07-12 19:29:36 +000010#include <stdio.h>
11#include <stdlib.h>
12#include <string.h>
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000013#include <sys/types.h>
Alexandre Julliard767e6f61998-08-09 12:47:43 +000014#include <sys/uio.h>
Alexandre Julliard642d3131998-07-12 19:29:36 +000015#include <unistd.h>
16
Alexandre Julliard767e6f61998-08-09 12:47:43 +000017#include "winnt.h"
Alexandre Julliard642d3131998-07-12 19:29:36 +000018#include "winerror.h"
19#include "server.h"
Alexandre Julliard767e6f61998-08-09 12:47:43 +000020#include "server/thread.h"
Alexandre Julliard642d3131998-07-12 19:29:36 +000021
22
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000023/* thread queues */
24
25struct wait_queue_entry
26{
27 struct wait_queue_entry *next;
28 struct wait_queue_entry *prev;
29 struct object *obj;
30 struct thread *thread;
31};
32
33struct thread_wait
34{
35 int count; /* count of objects */
36 int flags;
37 struct timeval timeout;
38 struct wait_queue_entry queues[1];
39};
40
Alexandre Julliard62a8b431999-01-19 17:48:23 +000041/* asynchronous procedure calls */
42
43struct thread_apc
44{
45 void *func; /* function to call in client */
46 void *param; /* function param */
47};
48#define MAX_THREAD_APC 16 /* Max outstanding APCs for a thread */
49
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000050
Alexandre Julliard642d3131998-07-12 19:29:36 +000051/* thread operations */
52
Alexandre Julliard767e6f61998-08-09 12:47:43 +000053static void dump_thread( struct object *obj, int verbose );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000054static int thread_signaled( struct object *obj, struct thread *thread );
Alexandre Julliard642d3131998-07-12 19:29:36 +000055static void destroy_thread( struct object *obj );
56
57static const struct object_ops thread_ops =
58{
Alexandre Julliard767e6f61998-08-09 12:47:43 +000059 dump_thread,
Alexandre Julliardc6e45ed1998-12-27 08:35:39 +000060 add_queue,
61 remove_queue,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000062 thread_signaled,
Alexandre Julliardaa0ebd01998-12-30 12:06:45 +000063 no_satisfied,
64 no_read_fd,
65 no_write_fd,
66 no_flush,
Alexandre Julliard05625391999-01-03 11:55:56 +000067 no_get_file_info,
Alexandre Julliard642d3131998-07-12 19:29:36 +000068 destroy_thread
69};
70
Alexandre Julliard767e6f61998-08-09 12:47:43 +000071static struct thread *first_thread;
72
Alexandre Julliard642d3131998-07-12 19:29:36 +000073
74/* create a new thread */
Alexandre Julliard767e6f61998-08-09 12:47:43 +000075struct thread *create_thread( int fd, void *pid, int *thread_handle,
76 int *process_handle )
Alexandre Julliard642d3131998-07-12 19:29:36 +000077{
78 struct thread *thread;
79 struct process *process;
80
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000081 if (!(thread = mem_alloc( sizeof(*thread) ))) return NULL;
Alexandre Julliard767e6f61998-08-09 12:47:43 +000082
83 if (pid) process = get_process_from_id( pid );
84 else process = create_process();
85 if (!process)
Alexandre Julliard642d3131998-07-12 19:29:36 +000086 {
Alexandre Julliard767e6f61998-08-09 12:47:43 +000087 free( thread );
Alexandre Julliard642d3131998-07-12 19:29:36 +000088 return NULL;
89 }
Alexandre Julliard767e6f61998-08-09 12:47:43 +000090
Alexandre Julliard642d3131998-07-12 19:29:36 +000091 init_object( &thread->obj, &thread_ops, NULL );
92 thread->client_fd = fd;
93 thread->process = process;
94 thread->unix_pid = 0; /* not known yet */
95 thread->name = NULL;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000096 thread->mutex = NULL;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000097 thread->wait = NULL;
Alexandre Julliard62a8b431999-01-19 17:48:23 +000098 thread->apc = NULL;
99 thread->apc_count = 0;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000100 thread->error = 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000101 thread->state = STARTING;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000102 thread->exit_code = 0x103; /* STILL_ACTIVE */
103 thread->next = first_thread;
104 thread->prev = NULL;
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000105 thread->priority = THREAD_PRIORITY_NORMAL;
106 thread->affinity = 1;
107 thread->suspend = 0;
Alexandre Julliard642d3131998-07-12 19:29:36 +0000108
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000109 if (first_thread) first_thread->prev = thread;
Alexandre Julliard642d3131998-07-12 19:29:36 +0000110 first_thread = thread;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000111 add_process_thread( process, thread );
Alexandre Julliard642d3131998-07-12 19:29:36 +0000112
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000113 *thread_handle = *process_handle = -1;
114 if (current)
Alexandre Julliard642d3131998-07-12 19:29:36 +0000115 {
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000116 if ((*thread_handle = alloc_handle( current->process, thread,
117 THREAD_ALL_ACCESS, 0 )) == -1)
118 goto error;
Alexandre Julliard642d3131998-07-12 19:29:36 +0000119 }
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000120 if (current && !pid)
121 {
122 if ((*process_handle = alloc_handle( current->process, process,
123 PROCESS_ALL_ACCESS, 0 )) == -1)
124 goto error;
125 }
126
127 if (add_client( fd, thread ) == -1) goto error;
128
Alexandre Julliard642d3131998-07-12 19:29:36 +0000129 return thread;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000130
131 error:
132 if (current)
133 {
134 close_handle( current->process, *thread_handle );
135 close_handle( current->process, *process_handle );
136 }
137 remove_process_thread( process, thread );
138 release_object( thread );
139 return NULL;
Alexandre Julliard642d3131998-07-12 19:29:36 +0000140}
141
142/* destroy a thread when its refcount is 0 */
143static void destroy_thread( struct object *obj )
144{
145 struct thread *thread = (struct thread *)obj;
146 assert( obj->ops == &thread_ops );
147
148 release_object( thread->process );
149 if (thread->next) thread->next->prev = thread->prev;
150 if (thread->prev) thread->prev->next = thread->next;
151 else first_thread = thread->next;
152 if (thread->name) free( thread->name );
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000153 if (thread->apc) free( thread->apc );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000154 if (debug_level) memset( thread, 0xaa, sizeof(thread) ); /* catch errors */
Alexandre Julliard642d3131998-07-12 19:29:36 +0000155 free( thread );
156}
157
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000158/* dump a thread on stdout for debugging purposes */
159static void dump_thread( struct object *obj, int verbose )
160{
161 struct thread *thread = (struct thread *)obj;
162 assert( obj->ops == &thread_ops );
163
Alexandre Julliard05625391999-01-03 11:55:56 +0000164 fprintf( stderr, "Thread pid=%d fd=%d name='%s'\n",
165 thread->unix_pid, thread->client_fd, thread->name );
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000166}
167
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000168static int thread_signaled( struct object *obj, struct thread *thread )
169{
170 struct thread *mythread = (struct thread *)obj;
171 return (mythread->state == TERMINATED);
172}
173
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000174/* get a thread pointer from a thread id (and increment the refcount) */
Alexandre Julliard642d3131998-07-12 19:29:36 +0000175struct thread *get_thread_from_id( void *id )
176{
177 struct thread *t = first_thread;
178 while (t && (t != id)) t = t->next;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000179 if (t) grab_object( t );
Alexandre Julliard642d3131998-07-12 19:29:36 +0000180 return t;
181}
182
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000183/* get a thread from a handle (and increment the refcount) */
184struct thread *get_thread_from_handle( int handle, unsigned int access )
Alexandre Julliard642d3131998-07-12 19:29:36 +0000185{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000186 return (struct thread *)get_handle_obj( current->process, handle,
187 access, &thread_ops );
188}
189
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000190/* get all information about a thread */
191void get_thread_info( struct thread *thread,
192 struct get_thread_info_reply *reply )
193{
194 reply->pid = thread;
195 reply->exit_code = thread->exit_code;
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000196 reply->priority = thread->priority;
197}
198
199
200/* set all information about a thread */
201void set_thread_info( struct thread *thread,
202 struct set_thread_info_request *req )
203{
204 if (req->mask & SET_THREAD_INFO_PRIORITY)
205 thread->priority = req->priority;
206 if (req->mask & SET_THREAD_INFO_AFFINITY)
207 {
208 if (req->affinity != 1) SET_ERROR( ERROR_INVALID_PARAMETER );
209 else thread->affinity = req->affinity;
210 }
211}
212
213/* suspend a thread */
214int suspend_thread( struct thread *thread )
215{
216 int old_count = thread->suspend;
217 if (thread->suspend < MAXIMUM_SUSPEND_COUNT)
218 {
219 if (!thread->suspend++)
220 {
221 if (thread->unix_pid) kill( thread->unix_pid, SIGSTOP );
222 }
223 }
224 return old_count;
225}
226
227/* resume a thread */
228int resume_thread( struct thread *thread )
229{
230 int old_count = thread->suspend;
231 if (thread->suspend > 0)
232 {
233 if (!--thread->suspend)
234 {
235 if (thread->unix_pid) kill( thread->unix_pid, SIGCONT );
236 }
237 }
238 return old_count;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000239}
240
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000241/* send a reply to a thread */
242int send_reply( struct thread *thread, int pass_fd, int n,
243 ... /* arg_1, len_1, ..., arg_n, len_n */ )
244{
245 struct iovec vec[16];
246 va_list args;
247 int i;
248
249 assert( n < 16 );
250 va_start( args, n );
251 for (i = 0; i < n; i++)
252 {
253 vec[i].iov_base = va_arg( args, void * );
254 vec[i].iov_len = va_arg( args, int );
255 }
256 va_end( args );
257 return send_reply_v( thread->client_fd, thread->error, pass_fd, vec, n );
258}
259
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000260/* add a thread to an object wait queue; return 1 if OK, 0 on error */
Alexandre Julliarda8b8d9c1999-01-01 16:59:27 +0000261int add_queue( struct object *obj, struct wait_queue_entry *entry )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000262{
Alexandre Julliardc6e45ed1998-12-27 08:35:39 +0000263 grab_object( obj );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000264 entry->obj = obj;
265 entry->prev = obj->tail;
266 entry->next = NULL;
267 if (obj->tail) obj->tail->next = entry;
268 else obj->head = entry;
269 obj->tail = entry;
Alexandre Julliarda8b8d9c1999-01-01 16:59:27 +0000270 return 1;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000271}
272
273/* remove a thread from an object wait queue */
Alexandre Julliardc6e45ed1998-12-27 08:35:39 +0000274void remove_queue( struct object *obj, struct wait_queue_entry *entry )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000275{
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000276 if (entry->next) entry->next->prev = entry->prev;
277 else obj->tail = entry->prev;
278 if (entry->prev) entry->prev->next = entry->next;
279 else obj->head = entry->next;
280 release_object( obj );
281}
282
283/* finish waiting */
284static void end_wait( struct thread *thread )
285{
286 struct thread_wait *wait = thread->wait;
287 struct wait_queue_entry *entry;
288 int i;
289
290 assert( wait );
Alexandre Julliardc6e45ed1998-12-27 08:35:39 +0000291 for (i = 0, entry = wait->queues; i < wait->count; i++, entry++)
292 entry->obj->ops->remove_queue( entry->obj, entry );
293 if (wait->flags & SELECT_TIMEOUT) set_select_timeout( thread->client_fd, NULL );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000294 free( wait );
295 thread->wait = NULL;
296}
297
298/* build the thread wait structure */
299static int wait_on( struct thread *thread, int count,
300 int *handles, int flags, int timeout )
301{
302 struct thread_wait *wait;
303 struct wait_queue_entry *entry;
304 struct object *obj;
305 int i;
306
307 if ((count < 0) || (count > MAXIMUM_WAIT_OBJECTS))
308 {
309 SET_ERROR( ERROR_INVALID_PARAMETER );
310 return 0;
311 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000312 if (!(wait = mem_alloc( sizeof(*wait) + (count-1) * sizeof(*entry) ))) return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000313 thread->wait = wait;
314 wait->count = count;
315 wait->flags = flags;
316 if (flags & SELECT_TIMEOUT)
317 {
318 gettimeofday( &wait->timeout, 0 );
319 if (timeout)
320 {
321 wait->timeout.tv_usec += (timeout % 1000) * 1000;
322 if (wait->timeout.tv_usec >= 1000000)
323 {
324 wait->timeout.tv_usec -= 1000000;
325 wait->timeout.tv_sec++;
326 }
327 wait->timeout.tv_sec += timeout / 1000;
328 }
329 }
330
331 for (i = 0, entry = wait->queues; i < count; i++, entry++)
332 {
333 if (!(obj = get_handle_obj( thread->process, handles[i],
334 SYNCHRONIZE, NULL )))
335 {
336 wait->count = i - 1;
337 end_wait( thread );
338 return 0;
339 }
340 entry->thread = thread;
Alexandre Julliarda8b8d9c1999-01-01 16:59:27 +0000341 if (!obj->ops->add_queue( obj, entry ))
342 {
343 wait->count = i - 1;
344 end_wait( thread );
345 return 0;
346 }
Alexandre Julliardc6e45ed1998-12-27 08:35:39 +0000347 release_object( obj );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000348 }
349 return 1;
350}
351
352/* check if the thread waiting condition is satisfied */
353static int check_wait( struct thread *thread, int *signaled )
354{
355 int i;
356 struct thread_wait *wait = thread->wait;
357 struct wait_queue_entry *entry = wait->queues;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000358
359 assert( wait );
360 if (wait->flags & SELECT_ALL)
361 {
362 for (i = 0, entry = wait->queues; i < wait->count; i++, entry++)
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000363 if (!entry->obj->ops->signaled( entry->obj, thread )) goto other_checks;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000364 /* Wait satisfied: tell it to all objects */
365 *signaled = 0;
366 for (i = 0, entry = wait->queues; i < wait->count; i++, entry++)
367 if (entry->obj->ops->satisfied( entry->obj, thread ))
368 *signaled = STATUS_ABANDONED_WAIT_0;
369 return 1;
370 }
371 else
372 {
373 for (i = 0, entry = wait->queues; i < wait->count; i++, entry++)
374 {
375 if (!entry->obj->ops->signaled( entry->obj, thread )) continue;
376 /* Wait satisfied: tell it to the object */
377 *signaled = i;
378 if (entry->obj->ops->satisfied( entry->obj, thread ))
379 *signaled += STATUS_ABANDONED_WAIT_0;
380 return 1;
381 }
382 }
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000383
384 other_checks:
385 if ((wait->flags & SELECT_ALERTABLE) && thread->apc)
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000386 {
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000387 *signaled = STATUS_USER_APC;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000388 return 1;
389 }
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000390 if (wait->flags & SELECT_TIMEOUT)
391 {
392 struct timeval now;
393 gettimeofday( &now, NULL );
394 if ((now.tv_sec > wait->timeout.tv_sec) ||
395 ((now.tv_sec == wait->timeout.tv_sec) &&
396 (now.tv_usec >= wait->timeout.tv_usec)))
397 {
398 *signaled = STATUS_TIMEOUT;
399 return 1;
400 }
401 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000402 return 0;
403}
404
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000405/* send the select reply to wake up the client */
406static void send_select_reply( struct thread *thread, int signaled )
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000407{
408 struct select_reply reply;
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000409 reply.signaled = signaled;
410 if ((signaled == STATUS_USER_APC) && thread->apc)
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000411 {
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000412 struct thread_apc *apc = thread->apc;
413 int len = thread->apc_count * sizeof(*apc);
414 thread->apc = NULL;
415 thread->apc_count = 0;
416 send_reply( thread, -1, 2, &reply, sizeof(reply),
417 apc, len );
418 free( apc );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000419 }
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000420 else send_reply( thread, -1, 1, &reply, sizeof(reply) );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000421}
422
423/* attempt to wake up a thread */
424/* return 1 if OK, 0 if the wait condition is still not satisfied */
425static int wake_thread( struct thread *thread )
426{
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000427 int signaled;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000428
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000429 if (!check_wait( thread, &signaled )) return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000430 end_wait( thread );
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000431 send_select_reply( thread, signaled );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000432 return 1;
433}
434
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000435/* sleep on a list of objects */
436void sleep_on( struct thread *thread, int count, int *handles, int flags, int timeout )
437{
438 assert( !thread->wait );
439 if (!wait_on( thread, count, handles, flags, timeout ))
440 {
441 /* return an error */
442 send_select_reply( thread, -1 );
443 return;
444 }
445 if (!wake_thread( thread ))
446 {
447 /* we need to wait */
448 if (flags & SELECT_TIMEOUT)
449 set_select_timeout( thread->client_fd, &thread->wait->timeout );
450 }
451}
452
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000453/* timeout for the current thread */
454void thread_timeout(void)
455{
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000456 assert( current->wait );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000457 end_wait( current );
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000458 send_select_reply( current, STATUS_TIMEOUT );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000459}
460
461/* attempt to wake threads sleeping on the object wait queue */
462void wake_up( struct object *obj, int max )
463{
464 struct wait_queue_entry *entry = obj->head;
465
466 while (entry)
467 {
468 struct wait_queue_entry *next = entry->next;
469 if (wake_thread( entry->thread ))
470 {
471 if (max && !--max) break;
472 }
473 entry = next;
474 }
475}
476
Alexandre Julliard62a8b431999-01-19 17:48:23 +0000477/* queue an async procedure call */
478int thread_queue_apc( struct thread *thread, void *func, void *param )
479{
480 struct thread_apc *apc;
481 if (!func)
482 {
483 SET_ERROR( ERROR_INVALID_PARAMETER );
484 return 0;
485 }
486 if (!thread->apc)
487 {
488 if (!(thread->apc = mem_alloc( MAX_THREAD_APC * sizeof(*apc) )))
489 return 0;
490 thread->apc_count = 0;
491 }
492 else if (thread->apc_count >= MAX_THREAD_APC) return 0;
493 thread->apc[thread->apc_count].func = func;
494 thread->apc[thread->apc_count].param = param;
495 thread->apc_count++;
496 wake_thread( thread );
497 return 1;
498}
499
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000500/* kill a thread on the spot */
501void kill_thread( struct thread *thread, int exit_code )
502{
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000503 if (thread->state == TERMINATED) return; /* already killed */
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000504 if (thread->unix_pid) kill( thread->unix_pid, SIGTERM );
505 remove_client( thread->client_fd, exit_code ); /* this will call thread_killed */
Alexandre Julliard642d3131998-07-12 19:29:36 +0000506}
507
508/* a thread has been killed */
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000509void thread_killed( struct thread *thread, int exit_code )
Alexandre Julliard642d3131998-07-12 19:29:36 +0000510{
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000511 thread->state = TERMINATED;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000512 thread->exit_code = exit_code;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000513 if (thread->wait) end_wait( thread );
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000514 abandon_mutexes( thread );
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000515 remove_process_thread( thread->process, thread );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000516 wake_up( &thread->obj, 0 );
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000517 release_object( thread );
Alexandre Julliard642d3131998-07-12 19:29:36 +0000518}