Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Waitable timers management |
| 3 | * |
| 4 | * Copyright (C) 1999 Alexandre Julliard |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Alexandre Julliard | 5769d1d | 2002-04-26 19:05:15 +0000 | [diff] [blame] | 21 | #include "config.h" |
| 22 | #include "wine/port.h" |
| 23 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 24 | #include <assert.h> |
| 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> |
| 27 | #include <sys/time.h> |
| 28 | #include <sys/types.h> |
Robert Lunnon | 95414ef | 2005-11-22 12:01:05 +0000 | [diff] [blame] | 29 | #include <stdarg.h> |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 30 | |
Ge van Geldorp | 1a1583a | 2005-11-28 17:32:54 +0100 | [diff] [blame] | 31 | #include "ntstatus.h" |
| 32 | #define WIN32_NO_STATUS |
Alexandre Julliard | 435e2e6 | 2002-12-10 22:56:43 +0000 | [diff] [blame] | 33 | #include "windef.h" |
Vitaliy Margolen | a996000 | 2005-10-27 18:30:37 +0000 | [diff] [blame] | 34 | #include "winternl.h" |
Alexandre Julliard | e66207e | 2003-02-19 00:33:32 +0000 | [diff] [blame] | 35 | |
| 36 | #include "file.h" |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 37 | #include "handle.h" |
| 38 | #include "request.h" |
| 39 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 40 | struct timer |
| 41 | { |
| 42 | struct object obj; /* object header */ |
| 43 | int manual; /* manual reset */ |
| 44 | int signaled; /* current signaled state */ |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 45 | unsigned int period; /* timer period in ms */ |
| 46 | timeout_t when; /* next expiration */ |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 47 | struct timeout_user *timeout; /* timeout user */ |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 48 | struct thread *thread; /* thread that set the APC function */ |
Alexandre Julliard | 9b92a59 | 2008-12-29 17:43:01 +0100 | [diff] [blame] | 49 | client_ptr_t callback; /* callback APC function */ |
| 50 | client_ptr_t arg; /* callback argument */ |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | static void timer_dump( struct object *obj, int verbose ); |
Alexandre Julliard | 8382eb0 | 2007-12-05 18:16:42 +0100 | [diff] [blame] | 54 | static struct object_type *timer_get_type( struct object *obj ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 55 | static int timer_signaled( struct object *obj, struct thread *thread ); |
| 56 | static int timer_satisfied( struct object *obj, struct thread *thread ); |
Alexandre Julliard | 03f46e1 | 2005-12-12 14:58:44 +0100 | [diff] [blame] | 57 | static unsigned int timer_map_access( struct object *obj, unsigned int access ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 58 | static void timer_destroy( struct object *obj ); |
| 59 | |
| 60 | static const struct object_ops timer_ops = |
| 61 | { |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 62 | sizeof(struct timer), /* size */ |
| 63 | timer_dump, /* dump */ |
Alexandre Julliard | 8382eb0 | 2007-12-05 18:16:42 +0100 | [diff] [blame] | 64 | timer_get_type, /* get_type */ |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 65 | add_queue, /* add_queue */ |
| 66 | remove_queue, /* remove_queue */ |
| 67 | timer_signaled, /* signaled */ |
| 68 | timer_satisfied, /* satisfied */ |
Mike McCormack | f92fff6 | 2005-04-24 17:35:52 +0000 | [diff] [blame] | 69 | no_signal, /* signal */ |
Alexandre Julliard | 1ab243b | 2000-12-19 02:12:45 +0000 | [diff] [blame] | 70 | no_get_fd, /* get_fd */ |
Alexandre Julliard | 03f46e1 | 2005-12-12 14:58:44 +0100 | [diff] [blame] | 71 | timer_map_access, /* map_access */ |
Rob Shearman | c1707d8 | 2007-10-03 13:10:37 +0100 | [diff] [blame] | 72 | default_get_sd, /* get_sd */ |
| 73 | default_set_sd, /* set_sd */ |
Vitaliy Margolen | baffcb9 | 2005-11-22 14:55:42 +0000 | [diff] [blame] | 74 | no_lookup_name, /* lookup_name */ |
Alexandre Julliard | 7e71c1d | 2007-03-22 11:44:29 +0100 | [diff] [blame] | 75 | no_open_file, /* open_file */ |
Alexandre Julliard | b9b1ea9 | 2005-06-09 15:39:52 +0000 | [diff] [blame] | 76 | no_close_handle, /* close_handle */ |
Alexandre Julliard | 1dca5e2 | 2000-01-01 00:56:27 +0000 | [diff] [blame] | 77 | timer_destroy /* destroy */ |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | |
| 81 | /* create a timer object */ |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 82 | static struct timer *create_timer( struct directory *root, const struct unicode_str *name, |
| 83 | unsigned int attr, int manual ) |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 84 | { |
| 85 | struct timer *timer; |
| 86 | |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 87 | if ((timer = create_named_object_dir( root, name, attr, &timer_ops ))) |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 88 | { |
Vitaliy Margolen | 893987b | 2005-11-21 16:27:03 +0000 | [diff] [blame] | 89 | if (get_error() != STATUS_OBJECT_NAME_EXISTS) |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 90 | { |
| 91 | /* initialize it if it didn't already exist */ |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 92 | timer->manual = manual; |
| 93 | timer->signaled = 0; |
| 94 | timer->when = 0; |
| 95 | timer->period = 0; |
| 96 | timer->timeout = NULL; |
| 97 | timer->thread = NULL; |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | return timer; |
| 101 | } |
| 102 | |
| 103 | /* callback on timer expiration */ |
| 104 | static void timer_callback( void *private ) |
| 105 | { |
| 106 | struct timer *timer = (struct timer *)private; |
| 107 | |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 108 | /* queue an APC */ |
| 109 | if (timer->thread) |
Alexandre Julliard | 15979fd | 2002-03-23 18:50:04 +0000 | [diff] [blame] | 110 | { |
Alexandre Julliard | 5c8421d | 2007-01-04 13:40:09 +0100 | [diff] [blame] | 111 | apc_call_t data; |
| 112 | |
| 113 | memset( &data, 0, sizeof(data) ); |
| 114 | if (timer->callback) |
| 115 | { |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 116 | data.type = APC_TIMER; |
| 117 | data.timer.func = timer->callback; |
| 118 | data.timer.time = timer->when; |
| 119 | data.timer.arg = timer->arg; |
Alexandre Julliard | 5c8421d | 2007-01-04 13:40:09 +0100 | [diff] [blame] | 120 | } |
| 121 | else data.type = APC_NONE; /* wake up only */ |
| 122 | |
| 123 | if (!thread_queue_apc( timer->thread, &timer->obj, &data )) |
Alexandre Julliard | 15979fd | 2002-03-23 18:50:04 +0000 | [diff] [blame] | 124 | { |
| 125 | release_object( timer->thread ); |
| 126 | timer->thread = NULL; |
| 127 | } |
| 128 | } |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 129 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 130 | if (timer->period) /* schedule the next expiration */ |
| 131 | { |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 132 | timer->when += (timeout_t)timer->period * 10000; |
| 133 | timer->timeout = add_timeout_user( timer->when, timer_callback, timer ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 134 | } |
| 135 | else timer->timeout = NULL; |
| 136 | |
| 137 | /* wake up waiters */ |
| 138 | timer->signaled = 1; |
| 139 | wake_up( &timer->obj, 0 ); |
| 140 | } |
| 141 | |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 142 | /* cancel a running timer */ |
Eric Pouech | 4c591d4 | 2003-05-20 04:00:42 +0000 | [diff] [blame] | 143 | static int cancel_timer( struct timer *timer ) |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 144 | { |
Eric Pouech | 4c591d4 | 2003-05-20 04:00:42 +0000 | [diff] [blame] | 145 | int signaled = timer->signaled; |
| 146 | |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 147 | if (timer->timeout) |
| 148 | { |
| 149 | remove_timeout_user( timer->timeout ); |
| 150 | timer->timeout = NULL; |
| 151 | } |
| 152 | if (timer->thread) |
| 153 | { |
Alexandre Julliard | 5c8421d | 2007-01-04 13:40:09 +0100 | [diff] [blame] | 154 | thread_cancel_apc( timer->thread, &timer->obj, APC_TIMER ); |
Alexandre Julliard | 15979fd | 2002-03-23 18:50:04 +0000 | [diff] [blame] | 155 | release_object( timer->thread ); |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 156 | timer->thread = NULL; |
| 157 | } |
Eric Pouech | 4c591d4 | 2003-05-20 04:00:42 +0000 | [diff] [blame] | 158 | return signaled; |
Alexandre Julliard | ea1afce | 2000-08-22 20:08:37 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 161 | /* set the timer expiration and period */ |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 162 | static int set_timer( struct timer *timer, timeout_t expire, unsigned int period, |
Alexandre Julliard | 9b92a59 | 2008-12-29 17:43:01 +0100 | [diff] [blame] | 163 | client_ptr_t callback, client_ptr_t arg ) |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 164 | { |
Eric Pouech | 4c591d4 | 2003-05-20 04:00:42 +0000 | [diff] [blame] | 165 | int signaled = cancel_timer( timer ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 166 | if (timer->manual) |
| 167 | { |
| 168 | period = 0; /* period doesn't make any sense for a manual timer */ |
| 169 | timer->signaled = 0; |
| 170 | } |
Alexandre Julliard | c362443 | 2007-08-09 17:16:26 +0200 | [diff] [blame] | 171 | timer->when = (expire <= 0) ? current_time - expire : max( expire, current_time ); |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 172 | timer->period = period; |
| 173 | timer->callback = callback; |
| 174 | timer->arg = arg; |
Alexandre Julliard | 15979fd | 2002-03-23 18:50:04 +0000 | [diff] [blame] | 175 | if (callback) timer->thread = (struct thread *)grab_object( current ); |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 176 | timer->timeout = add_timeout_user( timer->when, timer_callback, timer ); |
Eric Pouech | 4c591d4 | 2003-05-20 04:00:42 +0000 | [diff] [blame] | 177 | return signaled; |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 178 | } |
| 179 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 180 | static void timer_dump( struct object *obj, int verbose ) |
| 181 | { |
| 182 | struct timer *timer = (struct timer *)obj; |
| 183 | assert( obj->ops == &timer_ops ); |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 184 | fprintf( stderr, "Timer manual=%d when=%s period=%u ", |
| 185 | timer->manual, get_timeout_str(timer->when), timer->period ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 186 | dump_object_name( &timer->obj ); |
| 187 | fputc( '\n', stderr ); |
| 188 | } |
| 189 | |
Alexandre Julliard | 8382eb0 | 2007-12-05 18:16:42 +0100 | [diff] [blame] | 190 | static struct object_type *timer_get_type( struct object *obj ) |
| 191 | { |
| 192 | static const WCHAR name[] = {'T','i','m','e','r'}; |
| 193 | static const struct unicode_str str = { name, sizeof(name) }; |
| 194 | return get_object_type( &str ); |
| 195 | } |
| 196 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 197 | static int timer_signaled( struct object *obj, struct thread *thread ) |
| 198 | { |
| 199 | struct timer *timer = (struct timer *)obj; |
| 200 | assert( obj->ops == &timer_ops ); |
| 201 | return timer->signaled; |
| 202 | } |
| 203 | |
| 204 | static int timer_satisfied( struct object *obj, struct thread *thread ) |
| 205 | { |
| 206 | struct timer *timer = (struct timer *)obj; |
| 207 | assert( obj->ops == &timer_ops ); |
| 208 | if (!timer->manual) timer->signaled = 0; |
| 209 | return 0; |
| 210 | } |
| 211 | |
Alexandre Julliard | 03f46e1 | 2005-12-12 14:58:44 +0100 | [diff] [blame] | 212 | static unsigned int timer_map_access( struct object *obj, unsigned int access ) |
| 213 | { |
| 214 | if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | SYNCHRONIZE | TIMER_QUERY_STATE; |
| 215 | if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | TIMER_MODIFY_STATE; |
| 216 | if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE; |
| 217 | if (access & GENERIC_ALL) access |= TIMER_ALL_ACCESS; |
| 218 | return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); |
| 219 | } |
| 220 | |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 221 | static void timer_destroy( struct object *obj ) |
| 222 | { |
| 223 | struct timer *timer = (struct timer *)obj; |
| 224 | assert( obj->ops == &timer_ops ); |
| 225 | |
| 226 | if (timer->timeout) remove_timeout_user( timer->timeout ); |
Alexandre Julliard | 15979fd | 2002-03-23 18:50:04 +0000 | [diff] [blame] | 227 | if (timer->thread) release_object( timer->thread ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | /* create a timer */ |
| 231 | DECL_HANDLER(create_timer) |
| 232 | { |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 233 | struct timer *timer; |
Alexandre Julliard | ead9b06 | 2005-11-18 16:31:18 +0000 | [diff] [blame] | 234 | struct unicode_str name; |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 235 | struct directory *root = NULL; |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 236 | |
Alexandre Julliard | 9caa71e | 2001-11-30 18:46:42 +0000 | [diff] [blame] | 237 | reply->handle = 0; |
Alexandre Julliard | ead9b06 | 2005-11-18 16:31:18 +0000 | [diff] [blame] | 238 | get_req_unicode_str( &name ); |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 239 | if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) |
| 240 | return; |
| 241 | |
| 242 | if ((timer = create_timer( root, &name, req->attributes, req->manual ))) |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 243 | { |
Alexandre Julliard | 24560e7 | 2005-12-09 13:58:25 +0100 | [diff] [blame] | 244 | reply->handle = alloc_handle( current->process, timer, req->access, req->attributes ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 245 | release_object( timer ); |
| 246 | } |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 247 | |
| 248 | if (root) release_object( root ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | /* open a handle to a timer */ |
| 252 | DECL_HANDLER(open_timer) |
| 253 | { |
Alexandre Julliard | ead9b06 | 2005-11-18 16:31:18 +0000 | [diff] [blame] | 254 | struct unicode_str name; |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 255 | struct directory *root = NULL; |
Alexandre Julliard | 3764da6 | 2005-12-05 12:52:05 +0100 | [diff] [blame] | 256 | struct timer *timer; |
Alexandre Julliard | ead9b06 | 2005-11-18 16:31:18 +0000 | [diff] [blame] | 257 | |
| 258 | get_req_unicode_str( &name ); |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 259 | if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 ))) |
| 260 | return; |
| 261 | |
Alexandre Julliard | 3764da6 | 2005-12-05 12:52:05 +0100 | [diff] [blame] | 262 | if ((timer = open_object_dir( root, &name, req->attributes, &timer_ops ))) |
| 263 | { |
Alexandre Julliard | 24560e7 | 2005-12-09 13:58:25 +0100 | [diff] [blame] | 264 | reply->handle = alloc_handle( current->process, &timer->obj, req->access, req->attributes ); |
Alexandre Julliard | 3764da6 | 2005-12-05 12:52:05 +0100 | [diff] [blame] | 265 | release_object( timer ); |
| 266 | } |
Vitaliy Margolen | 7c5cb7a | 2005-12-02 16:05:54 +0100 | [diff] [blame] | 267 | |
| 268 | if (root) release_object( root ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | /* set a waitable timer */ |
| 272 | DECL_HANDLER(set_timer) |
| 273 | { |
| 274 | struct timer *timer; |
| 275 | |
| 276 | if ((timer = (struct timer *)get_handle_obj( current->process, req->handle, |
| 277 | TIMER_MODIFY_STATE, &timer_ops ))) |
| 278 | { |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 279 | reply->signaled = set_timer( timer, req->expire, req->period, req->callback, req->arg ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 280 | release_object( timer ); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /* cancel a waitable timer */ |
| 285 | DECL_HANDLER(cancel_timer) |
| 286 | { |
| 287 | struct timer *timer; |
| 288 | |
| 289 | if ((timer = (struct timer *)get_handle_obj( current->process, req->handle, |
| 290 | TIMER_MODIFY_STATE, &timer_ops ))) |
| 291 | { |
Eric Pouech | 4c591d4 | 2003-05-20 04:00:42 +0000 | [diff] [blame] | 292 | reply->signaled = cancel_timer( timer ); |
Alexandre Julliard | ad47a30 | 1999-11-29 01:58:35 +0000 | [diff] [blame] | 293 | release_object( timer ); |
| 294 | } |
| 295 | } |
Robert Shearman | 7572b12 | 2004-12-13 21:10:58 +0000 | [diff] [blame] | 296 | |
| 297 | /* Get information on a waitable timer */ |
| 298 | DECL_HANDLER(get_timer_info) |
| 299 | { |
| 300 | struct timer *timer; |
| 301 | |
| 302 | if ((timer = (struct timer *)get_handle_obj( current->process, req->handle, |
| 303 | TIMER_QUERY_STATE, &timer_ops ))) |
| 304 | { |
Alexandre Julliard | aaf477f | 2007-04-17 20:08:59 +0200 | [diff] [blame] | 305 | reply->when = timer->when; |
Robert Shearman | 7572b12 | 2004-12-13 21:10:58 +0000 | [diff] [blame] | 306 | reply->signaled = timer->signaled; |
| 307 | release_object( timer ); |
| 308 | } |
| 309 | } |