This commit is contained in:
whottgen 2006-09-25 12:26:58 +00:00
parent 34b0cbd170
commit 943b73001c
4 changed files with 12 additions and 5 deletions

View File

@ -87,6 +87,7 @@ int containers_destroy(container_handle_t *ch) {
} }
wh2 = wh; wh2 = wh;
wh = wh->next; wh = wh->next;
syslog(LOG_DEBUG, "containers_destroy: free worker handle %p", wh2);
free(wh2); free(wh2);
} }
@ -128,15 +129,15 @@ int containers_dispatcher(container_handle_t *ch, char *input, htbuffer_t *outpu
wh = wh->next) { wh = wh->next) {
wh_last = wh; wh_last = wh;
if (wh->id == classes->id) { if (wh->id == classes->id) {
syslog(LOG_DEBUG, "dispatcher: we already have a worker handle"); syslog(LOG_DEBUG, "dispatcher: we already have a worker handle: %p", wh);
wh2 = wh; wh2 = wh;
break; break;
} }
} }
if ((NULL == wh_last->next) && (NULL == wh2)) { if ((NULL == wh_last->next) && (NULL == wh2)) {
syslog(LOG_DEBUG, "dispatcher: we haven't one, we create one");
wh2 = (worker_handle_t*)htmalloc(sizeof(worker_handle_t)); wh2 = (worker_handle_t*)htmalloc(sizeof(worker_handle_t));
syslog(LOG_DEBUG, "dispatcher: we haven't one, we create one: %p", wh2);
wh2->id = classes->id; wh2->id = classes->id;
if (NULL != classes->descr->work_setup_function) { if (NULL != classes->descr->work_setup_function) {
err = (*classes->descr->work_setup_function)(classes->handle, &(wh2->handle)); err = (*classes->descr->work_setup_function)(classes->handle, &(wh2->handle));

View File

@ -4,9 +4,11 @@ import ConfigParser
import Connector import Connector
import verifier import verifier
import testworker
config = ConfigParser.ConfigParser() config = ConfigParser.ConfigParser()
config.read("test.ini"); config.read("test.ini");
Connector.threadedExecute(config, verifier.verifier, int(config.get('Global', 'Threads')), {}) #Connector.threadedExecute(config, verifier.verifier, int(config.get('Global', 'Threads')), {})
Connector.threadedExecute(config, testworker.test_worker1, int(config.get('Global', 'Threads')), {})

View File

@ -7,4 +7,7 @@ Threads: 20
AddressFile: addresses.lst AddressFile: addresses.lst
QueriesPerSession: 2 QueriesPerSession: 2
[TestWorker]
QueriesPerSession: 20

View File

@ -23,6 +23,7 @@
#include "containers_public.h" #include "containers_public.h"
#include "htmalloc.h" #include "htmalloc.h"
#include "htbuffer.h" #include "htbuffer.h"
#include "smmapd.h"
int test_worker1_init(cfgl_t *cfg, void **handle); int test_worker1_init(cfgl_t *cfg, void **handle);
@ -82,14 +83,14 @@ int test_worker1_work(void *handle, void *work_handle, char *input, htbuffer_t *
sprintf(o, "Test-Worker 1 receives %s (handle %s) (called %d)\n", sprintf(o, "Test-Worker 1 receives %s (handle %s) (called %d)\n",
input, (char*)handle, (((test_worker1_handle_t*)work_handle)->counter)++); input, (char*)handle, (((test_worker1_handle_t*)work_handle)->counter)++);
htbuffer_strcpy(output, o); htbuffer_strcpy(output, o);
return 0; return SMM_OK;
} }
int test_worker2_work(void *handle, void *work_handle, char *input, htbuffer_t *output) { int test_worker2_work(void *handle, void *work_handle, char *input, htbuffer_t *output) {
htbuffer_strcpy(output, "Test-Worker 2 receives"); htbuffer_strcpy(output, "Test-Worker 2 receives");
htbuffer_strcat(output, input); htbuffer_strcat(output, input);
htbuffer_strcat(output, "\n"); htbuffer_strcat(output, "\n");
return 0; return SMM_OK;
} }