Hello,

A few years ago I ported a Netscape NSAPI module to Apache 1.3 for a financial institution which assisted in processing financial transactions. This module created a sub-pool which contained a number of linked lists with session data created in the module initializer part of the module MODULE_VAR_EXPORT structure. All the threads of the Apache process could see the data and process information in the 'handler' part of the code.


in my new module I am using the ap_hook_post_config hook for pre-forking configuration and this:
Creates a Sub-pool
Connected to a mysql database
Creates a structure block in this new sub-pool from the data in the returned data.

In my module, instead of a handler I am using the ap_hook_check_access hook to verify the data as all I want to do is return a OK or Unauthorised

However in one condition I need to reset data in the database with new data. However, some threads do not see this change even thought is a shared memory pool.

I created a little test module to just increment a value in this code block each time I called the page and printout the next time it passed.

        ap_log_error(APLOG_MARK, APLOG_INFO,0,r->server,"Config = %ld",(long)cfg->Data);
        cfg->Data++;
        return OK;


[Thu Mar 23 09:34:22.779569 2023] [btest:info] [pid 26649] Config = 4
[Thu Mar 23 09:34:40.193054 2023] [btest:info] [pid 26647] Config = 5
[Thu Mar 23 09:34:40.193422 2023] [btest:info] [pid 26647] Config = 6
[Thu Mar 23 09:34:40.203726 2023] [btest:info] [pid 26647] Config = 7
[Thu Mar 23 09:34:40.206444 2023] [btest:info] [pid 26662] Config = 9
[Thu Mar 23 09:34:40.206663 2023] [btest:info] [pid 26651] Config = 27

Thread 26662 and 26651 still had inconsistent data.

Is there a way of sharing data between threads with out creating a semaphore


Appoligies if this has been asked before.


Bob

Reply via email to