123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #if 0
- // SPDX-License-Identifier: GPL-3.0-or-later
- // Copyright © 2018-2019 Ariadne Devos
- // XXX delete? -- react to readyness and completeness
- #include <sHT/intrisics.h>
- #include "worker.h"
- #include <errno.h>
- #include <stddef.h>
- #include <sys/epoll.h>
- #include <sys/socket.h>
- __attribute__((nonnull (1, 2)))
- static void
- sHT_other_task(struct sHT_worker *worker, struct sHT_task *task)
- {
- sHT_assert(0);
- }
- __attribute__((nonnull (1, 2)))
- static void
- sHT_aio_task(struct sHT_worker *worker, struct sHT_task *task)
- {
- sHT_assert(0);
- }
- void
- sHT_sendstatus_task(struct sHT_worker *worker, struct sHT_task *task)
- {
- sHT_assert(0);
- }
- /* The idea of calling read, write, recv, send, accept ... ourselves is that
- the worker's variable code (i.e. specialised code for TLS, HTTP, a prime
- sieve ...) is somewhat independent of the socket interfaces of the kernel.
- The worker can, however, still do this by itself using sHT_TASK_NOTHING.
- TODO: This allows us to treat intra-machine communication specially, e.g.
- with shared memory. (Note: this would require memory_order_relaxed or
- volatile.)
- */
- void
- sHT_perform_task(struct sHT_worker *worker, struct sHT_task *task)
- {
- /* The C compiler probably knows better than me how this should be
- compiled (e.g. with a jump table). */
- switch((enum sHT_task_type) (task->flags & sHT_TASK_TYPE_MASK)) {
- case sHT_TASK_T_DIY:
- sHT_other_task(worker, task);
- break;
- case sHT_TASK_T_SOCKET_STREAM:
- sHT_socket_task(worker, task);
- break;
- case sHT_TASK_T_ASYNC_IO:
- sHT_aio_task(worker, task);
- break;
- case sHT_TASK_T_ACCEPT:
- sHT_accept_task(worker, task);
- break;
- case sHT_TASK_T_SENDSTATUS:
- sHT_sendstatus_task(worker, task);
- break;
- default:
- sHT_assert(0 && task->flags);
- }
- }
- #endif
|