Deleted Added
sdiff udiff text old ( 302408 ) new ( 362181 )
full compact
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 233 unchanged lines hidden (view full) ---

242}
243
244static apr_status_t asio_pollset_cleanup(apr_pollset_t *pollset)
245{
246 DBG_BUFF
247 int rv;
248
249 DBG(4, "entered\n");
250 if (pollset->flags & APR_POLLSET_THREADSAFE) {
251 rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
252 DBG1(4, "asio_pollset_cleanup: msgctl(IPC_RMID) returned %d\n", rv);
253 }
254
255 return rv;
256}
257
258static apr_status_t asio_pollset_create(apr_pollset_t *pollset,
259 apr_uint32_t size,
260 apr_pool_t *p,
261 apr_uint32_t flags)
262{
263 DBG_BUFF
264 apr_status_t rv;
265 apr_pollset_private_t *priv;
266
267 DBG1(2, "entered, flags: %x\n", flags);
268
269 priv = pollset->p = apr_pcalloc(p, sizeof(*priv));
270
271 if (flags & APR_POLLSET_THREADSAFE) {
272#if APR_HAS_THREADS
273 if ((rv = apr_thread_mutex_create(&(priv->ring_lock),
274 APR_THREAD_MUTEX_DEFAULT,
275 p)) != APR_SUCCESS) {
276 DBG1(1, "apr_thread_mutex_create returned %d\n", rv);
277 pollset->p = NULL;
278 return rv;
279 }
280 rv = msgget(IPC_PRIVATE, S_IWUSR+S_IRUSR); /* user r/w perms */
281 if (rv < 0) {
282#if DEBUG
283 perror(__FUNCTION__ " msgget returned < 0 ");

--- 194 unchanged lines hidden (view full) ---

478
479static apr_status_t asio_pollset_remove(apr_pollset_t *pollset,
480 const apr_pollfd_t *descriptor)
481{
482 DBG_BUFF
483 asio_elem_t *elem;
484 apr_status_t rv = APR_SUCCESS;
485 apr_pollset_private_t *priv = pollset->p;
486 /* AIO_CANCEL is synchronous, so autodata works fine. */
487 struct aiocb cancel_a = {0};
488
489 int fd;
490
491 DBG(2, "entered\n");
492
493 if (!(pollset->flags & APR_POLLSET_THREADSAFE)) {
494 return posix_remove(pollset, descriptor);
495 }

--- 267 unchanged lines hidden (view full) ---

763
764 DBG1(2, "exiting, rv = %d\n", rv);
765
766 pollset_unlock_rings();
767
768 return rv;
769} /* end of asio_pollset_poll */
770
771static const apr_pollset_provider_t impl = {
772 asio_pollset_create,
773 asio_pollset_add,
774 asio_pollset_remove,
775 asio_pollset_poll,
776 asio_pollset_cleanup,
777 "asio"
778};
779
780const apr_pollset_provider_t *apr_pollset_provider_aio_msgq = &impl;
781
782#endif /* HAVE_AIO_MSGQ */