Lines Matching refs:event

41 void _php_ibase_free_event(ibase_event *event TSRMLS_DC) /* {{{ */  in _php_ibase_free_event()
45 event->state = DEAD; in _php_ibase_free_event()
47 if (event->link != NULL) { in _php_ibase_free_event()
50 if (event->link->handle != NULL && in _php_ibase_free_event()
51 isc_cancel_events(IB_STATUS, &event->link->handle, &event->event_id)) { in _php_ibase_free_event()
56 for (node = &event->link->event_head; *node != event; node = &(*node)->event_next); in _php_ibase_free_event()
57 *node = event->event_next; in _php_ibase_free_event()
60 if (event->callback) { in _php_ibase_free_event()
61 zval_dtor(event->callback); in _php_ibase_free_event()
62 FREE_ZVAL(event->callback); in _php_ibase_free_event()
63 event->callback = NULL; in _php_ibase_free_event()
65 _php_ibase_event_free(event->event_buffer,event->result_buffer); in _php_ibase_free_event()
67 for (i = 0; i < event->event_count; ++i) { in _php_ibase_free_event()
68 efree(event->events[i]); in _php_ibase_free_event()
70 efree(event->events); in _php_ibase_free_event()
199 static isc_callback _php_ibase_callback(ibase_event *event, /* {{{ */ in _php_ibase_callback() argument
203 TSRMLS_FETCH_FROM_CTX(event->thread_ctx); in _php_ibase_callback()
210 switch (event->state) { in _php_ibase_callback()
222 memcpy(event->result_buffer, result_buf, buffer_size); in _php_ibase_callback()
226 ZVAL_RESOURCE(&link_id, event->link_res_id); in _php_ibase_callback()
229 isc_event_counts(occurred_event, buffer_size, event->event_buffer, event->result_buffer); in _php_ibase_callback()
230 for (i = 0; i < event->event_count; ++i) { in _php_ibase_callback()
232 ZVAL_STRING(&event_name,event->events[i],0); in _php_ibase_callback()
239 event->callback, &return_value, 2, args TSRMLS_CC)) { in _php_ibase_callback()
240 _php_ibase_module_error("Error calling callback %s" TSRMLS_CC, Z_STRVAL_P(event->callback)); in _php_ibase_callback()
245 event->state = DEAD; in _php_ibase_callback()
250 if (isc_que_events(IB_STATUS, &event->link->handle, &event->event_id, buffer_size, in _php_ibase_callback()
251 event->event_buffer,(isc_callback)_php_ibase_callback, (void *)event)) { in _php_ibase_callback()
255 event->state = ACTIVE; in _php_ibase_callback()
273 ibase_event *event; in PHP_FUNCTION() local
337 event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0); in PHP_FUNCTION()
338 TSRMLS_SET_CTX(event->thread_ctx); in PHP_FUNCTION()
339 event->link_res_id = link_res_id; in PHP_FUNCTION()
340 event->link = ib_link; in PHP_FUNCTION()
341 event->event_count = 0; in PHP_FUNCTION()
342 event->state = NEW; in PHP_FUNCTION()
343 event->events = (char **) safe_emalloc(sizeof(char *),ZEND_NUM_ARGS()-i,0); in PHP_FUNCTION()
345 ALLOC_ZVAL(event->callback); in PHP_FUNCTION()
346 *event->callback = **cb_arg; in PHP_FUNCTION()
347 INIT_PZVAL(event->callback); in PHP_FUNCTION()
348 zval_copy_ctor(event->callback); in PHP_FUNCTION()
352 event->events[event->event_count++] = estrdup(Z_STRVAL_PP(args[i])); in PHP_FUNCTION()
356 _php_ibase_event_block(ib_link, event->event_count, event->events, in PHP_FUNCTION()
357 &buffer_size, &event->event_buffer, &event->result_buffer); in PHP_FUNCTION()
360 if (isc_que_events(IB_STATUS, &ib_link->handle, &event->event_id, buffer_size, in PHP_FUNCTION()
361 event->event_buffer,(isc_callback)_php_ibase_callback, (void *)event)) { in PHP_FUNCTION()
364 efree(event); in PHP_FUNCTION()
369 event->event_next = ib_link->event_head; in PHP_FUNCTION()
370 ib_link->event_head = event; in PHP_FUNCTION()
372 ZEND_REGISTER_RESOURCE(return_value, event, le_event); in PHP_FUNCTION()
387 ibase_event *event; in PHP_FUNCTION() local
389 ZEND_FETCH_RESOURCE(event, ibase_event *, &event_arg, -1, "Interbase event", le_event); in PHP_FUNCTION()
391 event->state = DEAD; in PHP_FUNCTION()