Date: Wed Feb 27 20:10:03 CET 2002
User: Derick Rethans
Directory: sapi_srm
Log Message:
[1.50]
- Hopefully fixed some problems with the hanging daemon
Modified files:
sapi_srm/srm.c (version: 1.46)
[FILE: /sapi_srm/srm.c]
--- sapi_srm/srm.c:1.45 Mon Feb 25 14:36:00 2002 GMT
+++ sapi_srm/srm.c Wed Feb 27 18:10:03 2002 GMT
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cvstemp,v 1.45 2002/02/25 15:36:00 derick Exp $ */
+/* $Id: cvstemp,v 1.46 2002/02/27 19:10:03 derick Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -296,19 +296,24 @@
srm_value *res_val;
srm_fmt_message (LL_DATA, "Event", "In use = %d", srmapp_pool.data[handle].used);
- /* Add message to queue */
- srmapp_pool.data[handle].event = event;
- srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Signal semaphore that a message is available */", __FILE__, __LINE__);
- sem_post(&srmapp_pool.data[handle].msg_sem);
-
- /* Wait for signal on result to be available */
- srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Wait for signal on result to be available */", __FILE__, __LINE__);
- sem_wait(&srmapp_pool.data[handle].res_sem);
- srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
-
- res_val = srmapp_pool.data[handle].res->data;
- res_val->ref_count++;
- srm_event_result_dtor(srmapp_pool.data[handle].res);
+ if (srmapp_pool.data[handle].used == 1) {
+ /* Add message to queue */
+ srmapp_pool.data[handle].event = event;
+ srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Signal semaphore that a message is available */", __FILE__, __LINE__);
+ sem_post(&srmapp_pool.data[handle].msg_sem);
+
+ /* Wait for signal on result to be available */
+ srm_fmt_message (LL_DATA, "Event", "%s:%d: /* Wait for signal on result to be available */", __FILE__, __LINE__);
+ sem_wait(&srmapp_pool.data[handle].res_sem);
+ srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
+
+ res_val = srmapp_pool.data[handle].res->data;
+ res_val->ref_count++;
+ srm_event_result_dtor(srmapp_pool.data[handle].res);
+ } else {
+ res_val = srm_value_init();
+ VALP_SET_NULL(res_val);
+ }
return res_val;
}
@@ -507,18 +512,29 @@
Free srmapp_handle struct */
static void srmapp_handle_dtor (void *data)
{
- srmapp_handle *h;
+ srmapp_handle *h;
+ srm_event_result *result;
int i,j,k;
h = (srmapp_handle *) data;
/* Mark the slot as free again */
+ srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
sem_wait (&srmapp_pool.mutex);
+ srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
srmapp_pool.data[h->id].used = FALSE;
+ srm_fmt_message (LL_DATA, "Event", "%s:%d", __FILE__, __LINE__);
sem_getvalue (&srmapp_pool.data[h->id].lock, &i);
sem_getvalue (&srmapp_pool.data[h->id].msg_sem, &j);
sem_getvalue (&srmapp_pool.data[h->id].res_sem, &k);
srm_fmt_message (LL_DATA, "DBG", "Semaphore values: %d %d %d", i, j, k);
+ if (j == 1) {
+ result = malloc (sizeof (srm_event_result));
+ result->data = srm_value_init();
+ VALP_SET_NULL(result->data);
+
+ save_result (h->id, result);
+ }
sem_destroy (&srmapp_pool.data[h->id].lock);
sem_destroy (&srmapp_pool.data[h->id].msg_sem);
sem_destroy (&srmapp_pool.data[h->id].res_sem);
@@ -560,6 +576,7 @@
srm_fmt_message (LL_DATA, "DBG", "Script ran succesfully");
} else {
srm_fmt_message (LL_DATA, "DBG", "Script ran UNsuccesfully");
+ srmapp_pool.data[h->id].used = FALSE;
}
efree (SG(server_context));
srm_sleep(1, 0); /* Give time to __abort to finish */
Received on Wed Feb 27 20:10:47 2002
This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 11:00:06 CET