Deleted Added
full compact
z_asio.c (302408) z_asio.c (362181)
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");
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 rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
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 }
251
254
252 DBG1(4, "exiting, msgctl(IPC_RMID) returned %d\n", rv);
253 return rv;
254}
255
256static apr_status_t asio_pollset_create(apr_pollset_t *pollset,
257 apr_uint32_t size,
258 apr_pool_t *p,
259 apr_uint32_t flags)
260{
261 DBG_BUFF
262 apr_status_t rv;
263 apr_pollset_private_t *priv;
264
265 DBG1(2, "entered, flags: %x\n", flags);
266
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
267 priv = pollset->p = apr_palloc(p, sizeof(*priv));
269 priv = pollset->p = apr_pcalloc(p, sizeof(*priv));
268
269 if (flags & APR_POLLSET_THREADSAFE) {
270#if APR_HAS_THREADS
270
271 if (flags & APR_POLLSET_THREADSAFE) {
272#if APR_HAS_THREADS
271 if (rv = apr_thread_mutex_create(&(priv->ring_lock),
273 if ((rv = apr_thread_mutex_create(&(priv->ring_lock),
272 APR_THREAD_MUTEX_DEFAULT,
274 APR_THREAD_MUTEX_DEFAULT,
273 p) != APR_SUCCESS) {
275 p)) != APR_SUCCESS) {
274 DBG1(1, "apr_thread_mutex_create returned %d\n", rv);
275 pollset->p = NULL;
276 return rv;
277 }
278 rv = msgget(IPC_PRIVATE, S_IWUSR+S_IRUSR); /* user r/w perms */
279 if (rv < 0) {
280#if DEBUG
281 perror(__FUNCTION__ " msgget returned < 0 ");

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

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

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

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