int main(void) { /* typical in 10000 service scenario: 150..1000 concurrently scheduled async jobs. */ const int num_checks_at_once = MAX_CONCURRENT_CHECKS; void* neb_handle; int i; char ok = 1; char * test_nebargs[] = { "config=extras/shared.conf", }; struct nebstruct_process_struct data_process_events; data_process_events.type = NEBTYPE_PROCESS_EVENTLOOPSTART; init_externals(); init_host(); init_svc(); init_svc_check(); neb_handle = load_neb("./mod_gearman2.o", test_nebargs[0]); neb_make_callbacks(NEBCALLBACK_PROCESS_DATA, &data_process_events); while (ok) { printf("Sending %i service checks.\n", num_checks_at_once); for (i = 0; i < num_checks_at_once; i++) { nebstruct_service_check_data* data_service_check; char host_name[16]; char service_name[16]; sprintf(host_name, "%i", i / 10); sprintf(service_name, "%i", i); data_service_check = setup_service(host_name, service_name); neb_make_callbacks(NEBCALLBACK_SERVICE_CHECK_DATA, data_service_check); } ok = (reap_cr_from_neb(num_checks_at_once) >= num_checks_at_once); } unload_neb(neb_handle); return 0; }
/// init the pd instance bool PdBase::PdContext::init(const int numInChannels, const int numOutChannels, const int sampleRate, bool queued) { bQueued = queued; // attach callbacks if(queued) { libpd_set_queued_printhook(libpd_print_concatenator); libpd_set_concatenated_printhook(_print); libpd_set_queued_banghook(_bang); libpd_set_queued_floathook(_float); libpd_set_queued_symbolhook(_symbol); libpd_set_queued_listhook(_list); libpd_set_queued_messagehook(_message); libpd_set_queued_noteonhook(_noteon); libpd_set_queued_controlchangehook(_controlchange); libpd_set_queued_programchangehook(_programchange); libpd_set_queued_pitchbendhook(_pitchbend); libpd_set_queued_aftertouchhook(_aftertouch); libpd_set_queued_polyaftertouchhook(_polyaftertouch); libpd_set_queued_midibytehook(_midibyte); // init libpd, should only be called once! if(!bLibPdInited) { libpd_queued_init(); init_externals(); bLibPdInited = true; } } else { libpd_set_printhook(libpd_print_concatenator); libpd_set_concatenated_printhook(_print); libpd_set_banghook(_bang); libpd_set_floathook(_float); libpd_set_symbolhook(_symbol); libpd_set_listhook(_list); libpd_set_messagehook(_message); libpd_set_noteonhook(_noteon); libpd_set_controlchangehook(_controlchange); libpd_set_programchangehook(_programchange); libpd_set_pitchbendhook(_pitchbend); libpd_set_aftertouchhook(_aftertouch); libpd_set_polyaftertouchhook(_polyaftertouch); libpd_set_midibytehook(_midibyte); // init libpd, should only be called once! if(!bLibPdInited) { libpd_init(); init_externals(); bLibPdInited = true; } } // init audio if(libpd_init_audio(numInChannels, numOutChannels, sampleRate) != 0) { return false; } bInited = true; return bInited; }