2016-08-07 16:25:30 +02:00
|
|
|
/****************************************************************************
|
2014-08-08 22:55:16 +02:00
|
|
|
* sched/timer/timer_delete.c
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
2020-03-11 21:09:41 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
2020-03-11 21:09:41 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
2020-03-11 21:09:41 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
2016-08-07 16:25:30 +02:00
|
|
|
****************************************************************************/
|
2007-03-21 01:56:49 +01:00
|
|
|
|
2016-08-07 16:25:30 +02:00
|
|
|
/****************************************************************************
|
2007-03-21 01:56:49 +01:00
|
|
|
* Included Files
|
2016-08-07 16:25:30 +02:00
|
|
|
****************************************************************************/
|
2007-03-21 01:56:49 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2011-04-05 17:50:01 +02:00
|
|
|
|
2007-03-21 01:56:49 +01:00
|
|
|
#include <time.h>
|
|
|
|
#include <errno.h>
|
2008-06-03 03:31:13 +02:00
|
|
|
|
2014-08-08 22:55:16 +02:00
|
|
|
#include "timer/timer.h"
|
2007-03-21 01:56:49 +01:00
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_POSIX_TIMERS
|
|
|
|
|
2016-08-07 16:25:30 +02:00
|
|
|
/****************************************************************************
|
2007-03-21 01:56:49 +01:00
|
|
|
* Public Functions
|
2016-08-07 16:25:30 +02:00
|
|
|
****************************************************************************/
|
2007-03-21 01:56:49 +01:00
|
|
|
|
2016-08-07 16:25:30 +02:00
|
|
|
/****************************************************************************
|
2012-07-14 21:30:31 +02:00
|
|
|
* Name: timer_delete
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2016-08-07 16:25:30 +02:00
|
|
|
* The timer_delete() function deletes the specified timer, timerid,
|
|
|
|
* previously created by the timer_create() function. If the timer is
|
|
|
|
* armed when timer_delete() is called, the timer will be automatically
|
|
|
|
* disarmed before removal. The disposition of pending signals for the
|
|
|
|
* deleted timer is unspecified.
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2008-06-03 03:21:12 +02:00
|
|
|
* timerid - The per-thread timer, previously created by the call to
|
2007-03-21 01:56:49 +01:00
|
|
|
* timer_create(), to be deleted.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2016-08-07 16:25:30 +02:00
|
|
|
* If the call succeeds, timer_create() will return 0 (OK). Otherwise,
|
|
|
|
* the function will return a value of -1 (ERROR) and set errno to
|
|
|
|
* indicate the error.
|
2007-03-21 01:56:49 +01:00
|
|
|
*
|
|
|
|
* EINVAL - The timer specified timerid is not valid.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
*
|
2016-08-07 16:25:30 +02:00
|
|
|
****************************************************************************/
|
2007-03-21 01:56:49 +01:00
|
|
|
|
|
|
|
int timer_delete(timer_t timerid)
|
|
|
|
{
|
2008-06-03 03:21:12 +02:00
|
|
|
int ret = timer_release((FAR struct posix_timer_s *)timerid);
|
|
|
|
if (ret < 0)
|
2008-06-01 19:46:26 +02:00
|
|
|
{
|
2012-07-14 21:30:31 +02:00
|
|
|
set_errno(-ret);
|
|
|
|
return ERROR;
|
2008-06-01 19:46:26 +02:00
|
|
|
}
|
2012-07-14 21:30:31 +02:00
|
|
|
|
2007-03-21 18:21:26 +01:00
|
|
|
return OK;
|
2007-03-21 01:56:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_DISABLE_POSIX_TIMERS */
|