Branch: Tag:

2004-06-01

2004-06-01 13:04:09 by Martin Stjernholm <mast@lysator.liu.se>

Replaced misthought CacheKey.call_activation_cbs_only with
CacheKey.activate_if_necessary.

Rev: server/base_server/prototypes.pike:1.138

6:   #include <module.h>   #include <variables.h>   #include <module_constants.h> - constant cvs_version="$Id: prototypes.pike,v 1.137 2004/05/25 19:11:29 mast Exp $"; + constant cvs_version="$Id: prototypes.pike,v 1.138 2004/06/01 13:04:09 mast Exp $";      #ifdef DAV_DEBUG   #define DAV_WERROR(X...) werror(X)
749:    cb (this, @args);    }    -  void activate() +  int activate()    //! Activate the cache key. This must be called when the key is -  //! stored in a cache. +  //! stored in a cache. Return nonzero if any callbacks got called.    {    // Relying on the interpreter lock here.    if (array(array(CacheActivationCB|array)) cbs = activation_cbs) {
759:    activation_cbs = 0;    foreach (cbs, [CacheActivationCB cb, array args])    cb (this, @args); +  return sizeof (cbs);    } -  +  return 0;    }       int activated()
769:    return !activation_cbs;    }    -  void call_activation_cbs_only() -  // Call the collected activation callbacks without activating the -  // key. This is a kludge to play safe in situations early in the -  // request path where we don't want to activate the key and where -  // there aren't any outstanding callbacks in the common case with a -  // direct request but might still be in the recursive case. Ignore -  // if you can. +  int activate_if_necessary() +  // Activate the key only if any activation cbs are installed. This +  // is a kludge to play safe in situations early in the request path +  // where we don't want to activate the key and where there aren't +  // any outstanding callbacks in the common case with a direct +  // request but might still be in the recursive case. Ignore if you +  // can.    {    // Relying on the interpreter lock here.    if (array(array(CacheActivationCB|array)) cbs = activation_cbs) { -  // Relying on the interpreter lock here too. -  activation_cbs = ({}); +  if (sizeof (cbs)) { +  if (this) +  // Relying on the interpreter lock here. +  activation_cbs = 0;    foreach (cbs, [CacheActivationCB cb, array args])    cb (this, @args); -  +  return 1;    }    } -  +  return 0; +  }       string _sprintf (int flag)    {