From: Arthur Kreitman
[mailto:artk@xxxxxxxxxxxxx]
Sent: Wednesday, January 03, 2007
9:25 AM
To: users@xxxxxxxxxxxxxxxx;
users@xxxxxxxxxxxxxxxx
Subject: RE: Adding
apr_thread_mutex_t to httpd.h
Here's an example that works, mod_isapi.c
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_request.h"
#include "http_log.h"
#include "util_script.h"
#include "mod_core.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_buckets.h"
#include "apr_thread_mutex.h"
#include "apr_thread_rwlock.h"
#include "apr_hash.h"
#include "mod_isapi.h"
Here's what I've tried for httpd.h
#include "ap_config.h"
#include "ap_mmn.h"
#include "apr.h"
#include "apr_general.h"
#include "apr_tables.h"
#include "apr_pools.h"
#include "apr_time.h"
#include "apr_network_io.h"
#include "apr_buckets.h"
#include "apr_poll.h"
#include "apr_file_io.h"
#include "os.h"
#include "apr_thread_mutex.h"
the error is that 'log_file_lock' uses undefined struct
'apr_thread_mutex_t'
it shouldn't be this hard to add a header file!
Arthur,
On Jan 3, 2007, at 9:04 AM, Arthur Kreitman wrote:
> I’m adding code to create new logs files periodically.
This is on
> winnt. Since none of the log file support is thread safe, I
want
> to add an access lock. I can’t seem to get
apr_thread_mutex_t
> defined in httpd.h. I’ve added #include
“apr_thead_mutex.h” to no
> avail, there’s some dependency I can’t quite see. Any of
you
> experts know the magic incantation?
That should do the trick. What do you do to make sure your build
system can find that header? I have an example module,
mod_example_ipc.c, that uses global mutexes. It doesn't explicitly
include any APR mutex header, but I seem to be so lucky as to pick it
up automatically:
#include "apr.h"
#include "apr_strings.h"
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "http_protocol.h"
#include "ap_config.h"
#if !defined(OS2) && !defined(WIN32) && !defined(BEOS)
&& !defined
(NETWARE)
#include "unixd.h"
#define MOD_EXIPC_SET_MUTEX_PERMS /* XXX Apache should define
something */
#endif
#if APR_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if APR_HAVE_UNISTD_H
#include <unistd.h>
#endif
For more details, see http://www.temme.net/sander/mod_example_ipc/
S.
--
sctemme@xxxxxxxxxx
http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4 B7B8 B2BE BC40 1529 24AF