1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /* shttpd - tasks
- Copyright (C) 2018 Ariadne Devos
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #ifndef _sHT_TASK_H
- #define _sHT_TASK_H
- #include <stdint.h>
- struct sHT_object_cache;
- #define sHT_TASK_SCHEDULED UINT32_C(1)
- /** Something to do that may block. If it would block, another task is run
- instead. It is automatically resumed. */
- struct sHT_task {
- /** Indicates which IO actions might be possible */
- uint32_t epollflags;
- /** @code{sHT_TASK_SCHEDULED}: this task is on a queue of things to
- do. */
- uint32_t flags;
- };
- /** Initialise the task @var{task}.
- This cleares its flags, and considers all IO actions to be potentially
- possible.
- @var{task} may not be concurrently acccessed.
- This cannot fail in any way. */
- __attribute__((nonnull(1)))
- static inline void
- sHT_init_task(struct sHT_task *task)
- {
- task->epollflags = ~UINT32_C(0);
- task->flags = 0;
- }
- #endif
|