Lines Matching refs:event
39 void _php_ibase_free_event(ibase_event *event TSRMLS_DC) /* {{{ */ in _php_ibase_free_event()
43 event->state = DEAD; in _php_ibase_free_event()
45 if (event->link != NULL) { in _php_ibase_free_event()
48 if (event->link->handle != NULL && in _php_ibase_free_event()
49 isc_cancel_events(IB_STATUS, &event->link->handle, &event->event_id)) { in _php_ibase_free_event()
54 for (node = &event->link->event_head; *node != event; node = &(*node)->event_next); in _php_ibase_free_event()
55 *node = event->event_next; in _php_ibase_free_event()
58 if (event->callback) { in _php_ibase_free_event()
59 zval_dtor(event->callback); in _php_ibase_free_event()
60 FREE_ZVAL(event->callback); in _php_ibase_free_event()
61 event->callback = NULL; in _php_ibase_free_event()
63 _php_ibase_event_free(event->event_buffer,event->result_buffer); in _php_ibase_free_event()
65 for (i = 0; i < event->event_count; ++i) { in _php_ibase_free_event()
66 efree(event->events[i]); in _php_ibase_free_event()
68 efree(event->events); in _php_ibase_free_event()
197 static isc_callback _php_ibase_callback(ibase_event *event, /* {{{ */ in _php_ibase_callback() argument
201 TSRMLS_FETCH_FROM_CTX(event->thread_ctx); in _php_ibase_callback()
208 switch (event->state) { in _php_ibase_callback()
220 memcpy(event->result_buffer, result_buf, buffer_size); in _php_ibase_callback()
224 ZVAL_RESOURCE(&link_id, event->link_res_id); in _php_ibase_callback()
227 isc_event_counts(occurred_event, buffer_size, event->event_buffer, event->result_buffer); in _php_ibase_callback()
228 for (i = 0; i < event->event_count; ++i) { in _php_ibase_callback()
230 ZVAL_STRING(&event_name,event->events[i],0); in _php_ibase_callback()
237 event->callback, &return_value, 2, args TSRMLS_CC)) { in _php_ibase_callback()
238 _php_ibase_module_error("Error calling callback %s" TSRMLS_CC, Z_STRVAL_P(event->callback)); in _php_ibase_callback()
243 event->state = DEAD; in _php_ibase_callback()
248 if (isc_que_events(IB_STATUS, &event->link->handle, &event->event_id, buffer_size, in _php_ibase_callback()
249 event->event_buffer,(isc_callback)_php_ibase_callback, (void *)event)) { in _php_ibase_callback()
253 event->state = ACTIVE; in _php_ibase_callback()
271 ibase_event *event; in PHP_FUNCTION() local
335 event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0); in PHP_FUNCTION()
336 TSRMLS_SET_CTX(event->thread_ctx); in PHP_FUNCTION()
337 event->link_res_id = link_res_id; in PHP_FUNCTION()
338 event->link = ib_link; in PHP_FUNCTION()
339 event->event_count = 0; in PHP_FUNCTION()
340 event->state = NEW; in PHP_FUNCTION()
341 event->events = (char **) safe_emalloc(sizeof(char *),ZEND_NUM_ARGS()-i,0); in PHP_FUNCTION()
343 ALLOC_ZVAL(event->callback); in PHP_FUNCTION()
344 *event->callback = **cb_arg; in PHP_FUNCTION()
345 INIT_PZVAL(event->callback); in PHP_FUNCTION()
346 zval_copy_ctor(event->callback); in PHP_FUNCTION()
350 event->events[event->event_count++] = estrdup(Z_STRVAL_PP(args[i])); in PHP_FUNCTION()
354 _php_ibase_event_block(ib_link, event->event_count, event->events, in PHP_FUNCTION()
355 &buffer_size, &event->event_buffer, &event->result_buffer); in PHP_FUNCTION()
358 if (isc_que_events(IB_STATUS, &ib_link->handle, &event->event_id, buffer_size, in PHP_FUNCTION()
359 event->event_buffer,(isc_callback)_php_ibase_callback, (void *)event)) { in PHP_FUNCTION()
362 efree(event); in PHP_FUNCTION()
367 event->event_next = ib_link->event_head; in PHP_FUNCTION()
368 ib_link->event_head = event; in PHP_FUNCTION()
370 ZEND_REGISTER_RESOURCE(return_value, event, le_event); in PHP_FUNCTION()
385 ibase_event *event; in PHP_FUNCTION() local
387 ZEND_FETCH_RESOURCE(event, ibase_event *, &event_arg, -1, "Interbase event", le_event); in PHP_FUNCTION()
389 event->state = DEAD; in PHP_FUNCTION()