httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Hyde <bh...@pobox.com>
Subject ap_current_thread?
Date Tue, 18 May 1999 14:40:20 GMT

I would like to have a routine in the APR API like so:

   ap_thread_t *ap_current_thread(void)


Let's work a little on the issue of what the thread
model looks like.

Let's look as some of the current code in 1.3.

API_EXPORT(void *) ap_palloc(struct pool *a, int reqsize)
{
   .. try to use a block alrady in the pool ...
   .. rarely fail ... then
    ap_block_alarms();
    (void) ap_acquire_mutex(alloc_mutex);
     ... utilize the global freelist of large blocks ...
    (void) ap_release_mutex(alloc_mutex);
    ap_unblock_alarms();
   .. etc ...
}

There are two syncronization things going on here.
 1) blocking signals.
 2) multiplexing the global freelist of large blocks.

The blocking of signals needs to change.

   ap_block_alarms(<expression that gets current thread>);

One of the many dimensions of this context debate is what
  <expression that gets current thread>
expression is.  

   a)  cntx->thread
   b)  pool->thread
   c)  ap_current_thread()

I have been arguing that B is the right awnser.

I'd like to change my mind.

I now think C is the right awnser.  Can the advocates of the context
explain why they would prefer not to have a

   ap_thread *ap_current_thread(void)

routine?

 - ben

Mime
View raw message