example/thread-pool/psi.c
void
INKPluginInit(int argc, const char *argv[])
{
  INKPluginRegistrationInfo info;
  int error, i;
  INKReturnCode retval;

  info.plugin_name = "psi";
  info.vendor_name = "Apache";
  info.support_email = "";

  if (!INKPluginRegister(INK_SDK_VERSION_5_2, &info)) {
    INKError("Plugin registration failed.\n");
  }

  if (!check_ts_version()) {
    INKError("Plugin requires Traffic Server 5.2.0 or later\n");
    return;
  }

  /* Initialize the psi directory = <plugin_path>/include */
  sprintf(psi_directory, "%s/%s", INKPluginDirGet(), PSI_PATH);

  /* create an INKTextLogObject to log any psi include */
  retval = INKTextLogObjectCreate("psi", INK_LOG_MODE_ADD_TIMESTAMP, &log);
  if (retval == INK_ERROR) {
    INKError("Failed creating log for psi plugin");
    log = NULL;
  }

  /* Create working threads */
  thread_init();
  init_queue(&job_queue);

  for (i = 0; i < NB_THREADS; i++) {
    char *thread_name = (char *) INKmalloc(64);
    sprintf(thread_name, "Thread[%d]", i);
    if (!INKThreadCreate((INKThreadFunc) thread_loop, thread_name)) {
      INKError("[INKPluginInit] Error while creating threads");
      return;
    }
  }

  retval = INKHttpHookAdd(INK_HTTP_READ_RESPONSE_HDR_HOOK, INKContCreate(read_response_handler, INKMutexCreate()));
  if (retval == INK_ERROR) {
    INKError("[INKPluginInit] Error while registering to read response hook");
    return;
  }

  INKDebug(DBG_TAG, "Plugin started");
}
/*-------------------------------------------------------------------------
  INKPluginInit
  Function called at plugin init time

  Input:
    argc  number of args
    argv  list vof args
  Output :
  Return Value:
  -------------------------------------------------------------------------*/
INKPluginInit
Function called at plugin init time

argc  number of args
argv  list vof args
Output :
Return Value.
INKPluginInit Function called at plugin init time argc number of args argv list vof args Output : Return Value .
void
INKPluginInit(int argc, const char *argv[])
{
  INKPluginRegistrationInfo info;
  int error, i;
  INKReturnCode retval;
  info.plugin_name = "psi";
  info.vendor_name = "Apache";
  info.support_email = "";
  if (!INKPluginRegister(INK_SDK_VERSION_5_2, &info)) {
    INKError("Plugin registration failed.\n");
  }
  if (!check_ts_version()) {
    INKError("Plugin requires Traffic Server 5.2.0 or later\n");
    return;
  }
  sprintf(psi_directory, "%s/%s", INKPluginDirGet(), PSI_PATH);
  retval = INKTextLogObjectCreate("psi", INK_LOG_MODE_ADD_TIMESTAMP, &log);
  if (retval == INK_ERROR) {
    INKError("Failed creating log for psi plugin");
    log = NULL;
  }
  thread_init();
  init_queue(&job_queue);
  for (i = 0; i < NB_THREADS; i++) {
    char *thread_name = (char *) INKmalloc(64);
    sprintf(thread_name, "Thread[%d]", i);
    if (!INKThreadCreate((INKThreadFunc) thread_loop, thread_name)) {
      INKError("[INKPluginInit] Error while creating threads");
      return;
    }
  }
  retval = INKHttpHookAdd(INK_HTTP_READ_RESPONSE_HDR_HOOK, INKContCreate(read_response_handler, INKMutexCreate()));
  if (retval == INK_ERROR) {
    INKError("[INKPluginInit] Error while registering to read response hook");
    return;
  }
  INKDebug(DBG_TAG, "Plugin started");
}
void INKPluginInit ( int argc , const char * argv [ ] ) { INKPluginRegistrationInfo info ; int error , i ; INKReturnCode retval ; info . plugin_name = " " ; info . vendor_name = " " ; info . support_email = " " ; if ( ! INKPluginRegister ( INK_SDK_VERSION_5_2 , & info ) ) { INKError ( " \n " ) ; } if ( ! check_ts_version ( ) ) { INKError ( " \n " ) ; return ; } sprintf ( psi_directory , " " , INKPluginDirGet ( ) , PSI_PATH ) ; retval = INKTextLogObjectCreate ( " " , INK_LOG_MODE_ADD_TIMESTAMP , & log ) ; if ( retval == INK_ERROR ) { INKError ( " " ) ; log = NULL ; } thread_init ( ) ; init_queue ( & job_queue ) ; for ( i = 0 ; i < NB_THREADS ; i ++ ) { char * thread_name = ( char * ) INKmalloc ( 64 ) ; sprintf ( thread_name , " " , i ) ; if ( ! INKThreadCreate ( ( INKThreadFunc ) thread_loop , thread_name ) ) { INKError ( " " ) ; return ; } } retval = INKHttpHookAdd ( INK_HTTP_READ_RESPONSE_HDR_HOOK , INKContCreate ( read_response_handler , INKMutexCreate ( ) ) ) ; if ( retval == INK_ERROR ) { INKError ( " " ) ; return ; } INKDebug ( DBG_TAG , " " ) ; }
INKPluginInit
Function called at plugin init time
INKPluginInit Function called at plugin init time
/* Initialize the psi directory = <plugin_path>/include */ /* create an INKTextLogObject to log any psi include */ /* Create working threads */