Ejemplo n.º 1
0
/* {{{ */
zval * pthreads_read_property (PTHREADS_READ_PROPERTY_PASSTHRU_D) {
	zend_long *guard = NULL;
	pthreads_object_t* threaded = PTHREADS_FETCH_FROM(Z_OBJ_P(object));

	rebuild_object_properties(&threaded->std);

	if (Z_OBJCE_P(object)->__get && (guard = pthreads_get_guard(&threaded->std, member)) && !((*guard) & IN_GET)) {
		zend_fcall_info fci = empty_fcall_info;
        zend_fcall_info_cache fcc = empty_fcall_info_cache;
		
		fci.size = sizeof(zend_fcall_info);
		fci.retval = rv;
		fci.object = &threaded->std;
		zend_fcall_info_argn(&fci, 1, member);
		fcc.initialized = 1;
		fcc.function_handler = Z_OBJCE_P(object)->__get;
		fcc.object = &threaded->std;
		
		(*guard) |= IN_GET;
		zend_call_function(&fci, &fcc);
		(*guard) &= ~IN_GET;

		zend_fcall_info_args_clear(&fci, 1);
	} else {
		pthreads_store_read(object, member, type, rv);
	}
	
	return rv;
} 
Ejemplo n.º 2
0
/* {{ reads a property from a thread, wherever it is available */
zval * pthreads_read_property (PTHREADS_READ_PROPERTY_PASSTHRU_D) {
	zval *value = NULL;
	PTHREAD pthreads = PTHREADS_FETCH_FROM(object);
	if (Z_TYPE_P(member)==IS_STRING) {
		if (pthreads_store_read(
			pthreads->store, 
			Z_STRVAL_P(member), Z_STRLEN_P(member), 
			&value TSRMLS_CC
		)!=SUCCESS) {	
			value = zend_handlers->read_property(PTHREADS_READ_PROPERTY_PASSTHRU_C);
		} else zend_handlers->write_property(PTHREADS_WRITE_PROPERTY_PASSTHRU_C);
	} else value = zend_handlers->read_property(PTHREADS_READ_PROPERTY_PASSTHRU_C);
	return value;
} 
Ejemplo n.º 3
0
/* {{ reads a property from a thread, wherever it is available */
zval * pthreads_read_property (PTHREADS_READ_PROPERTY_PASSTHRU_D) {
	zval *value = NULL, *mstring = NULL;
	PTHREAD pthreads = PTHREADS_FETCH_FROM(object);
	
	if (Z_TYPE_P(member) != IS_STRING) {
		ALLOC_ZVAL(mstring);
		*mstring = *member;
		zval_copy_ctor(
			mstring
		);
		INIT_PZVAL(mstring);
		convert_to_string(mstring);
		member = mstring;
#if PHP_VERSION_ID > 50399
		key = NULL;
#endif
	}
	
	if (Z_TYPE_P(member)==IS_STRING) {
		pthreads_store_read(pthreads->store, Z_STRVAL_P(member), Z_STRLEN_P(member), &value TSRMLS_CC);
	} else {
		zend_error(E_WARNING, "pthreads detected an attempt to use an unsupported kind of key in %s", Z_OBJCE_P(object)->name);
		if (value != NULL) {
			value = EG(
				uninitialized_zval_ptr
			);
			Z_ADDREF_P(value);
		}
	}

	if (mstring != NULL) {
		zval_ptr_dtor(&mstring);
	}
	
	return value;
}