2014-10-10 14:22:51 +02:00
|
|
|
/****************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* libs/libc/wqueue/wqueue.h
|
2014-10-10 14:22:51 +02:00
|
|
|
*
|
2021-03-02 15:54:21 +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
|
2014-10-10 14:22:51 +02:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-10-10 14:22:51 +02:00
|
|
|
*
|
2021-03-02 15:54:21 +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.
|
2014-10-10 14:22:51 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-10-10 16:35:58 +02:00
|
|
|
#ifndef __LIBC_WQUEUE_WQUEUE_H
|
|
|
|
#define __LIBC_WQUEUE_WQUEUE_H
|
|
|
|
|
2014-10-10 14:22:51 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2014-10-10 22:52:04 +02:00
|
|
|
#include <semaphore.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#include <nuttx/wqueue.h>
|
|
|
|
|
2021-08-01 09:27:08 +02:00
|
|
|
#if defined(CONFIG_LIBC_USRWORK) && !defined(__KERNEL__)
|
2014-10-10 14:22:51 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2014-10-10 16:35:58 +02:00
|
|
|
* Public Type Definitions
|
2014-10-10 14:22:51 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2014-10-11 00:24:50 +02:00
|
|
|
/* This structure defines the state of one user-modework queue. */
|
|
|
|
|
|
|
|
struct usr_wqueue_s
|
|
|
|
{
|
2021-07-26 04:36:13 +02:00
|
|
|
struct sq_queue_s q; /* The queue of pending work */
|
2021-07-12 14:58:03 +02:00
|
|
|
sem_t lock; /* exclusive access to user-mode work queue */
|
2021-07-26 04:36:13 +02:00
|
|
|
sem_t wake; /* The wake-up semaphore of the usrthread */
|
2014-10-11 00:24:50 +02:00
|
|
|
};
|
|
|
|
|
2014-10-10 14:22:51 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-10-10 16:35:58 +02:00
|
|
|
/* The state of the user mode work queue */
|
|
|
|
|
2014-10-11 00:24:50 +02:00
|
|
|
extern struct usr_wqueue_s g_usrwork;
|
2014-10-10 22:52:04 +02:00
|
|
|
|
2014-10-10 14:22:51 +02:00
|
|
|
/****************************************************************************
|
2014-10-10 16:35:58 +02:00
|
|
|
* Public Function Prototypes
|
2014-10-10 14:22:51 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2021-08-01 09:27:08 +02:00
|
|
|
#endif /* CONFIG_LIBC_USRWORK && !__KERNEL__*/
|
2014-10-10 16:35:58 +02:00
|
|
|
#endif /* __LIBC_WQUEUE_WQUEUE_H */
|