本文整理汇总了C++中MONO_OBJECT_SETREF函数的典型用法代码示例。如果您正苦于以下问题:C++ MONO_OBJECT_SETREF函数的具体用法?C++ MONO_OBJECT_SETREF怎么用?C++ MONO_OBJECT_SETREF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MONO_OBJECT_SETREF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mono_thread_pool_add
MonoAsyncResult *
mono_thread_pool_add (MonoObject *target, MonoMethodMessage *msg, MonoDelegate *async_callback,
MonoObject *state)
{
MonoDomain *domain = mono_domain_get ();
MonoAsyncResult *ares;
ASyncCall *ac;
ac = (ASyncCall*)mono_object_new (domain, async_call_klass);
MONO_OBJECT_SETREF (ac, msg, msg);
MONO_OBJECT_SETREF (ac, state, state);
if (async_callback) {
ac->cb_method = mono_get_delegate_invoke (((MonoObject *)async_callback)->vtable->klass);
MONO_OBJECT_SETREF (ac, cb_target, async_callback);
}
ares = mono_async_result_new (domain, NULL, ac->state, NULL, (MonoObject*)ac);
MONO_OBJECT_SETREF (ares, async_delegate, target);
#ifndef DISABLE_SOCKETS
if (socket_io_filter (target, state)) {
socket_io_add (ares, (MonoSocketAsyncResult *) state);
return ares;
}
#endif
threadpool_append_job (&async_tp, (MonoObject *) ares);
return ares;
}
示例2: mono_async_invoke
/* Returns the exception thrown when invoking, if any */
static MonoObject *
mono_async_invoke (ThreadPool *tp, MonoAsyncResult *ares)
{
ASyncCall *ac = (ASyncCall *)ares->object_data;
MonoObject *res, *exc = NULL;
MonoArray *out_args = NULL;
HANDLE wait_event = NULL;
if (ares->execution_context) {
/* use captured ExecutionContext (if available) */
MONO_OBJECT_SETREF (ares, original_context, mono_thread_get_execution_context ());
mono_thread_set_execution_context (ares->execution_context);
} else {
ares->original_context = NULL;
}
if (ac == NULL) {
/* Fast path from ThreadPool.*QueueUserWorkItem */
void *pa = ares->async_state;
mono_runtime_delegate_invoke (ares->async_delegate, &pa, &exc);
} else {
MonoObject *cb_exc = NULL;
ac->msg->exc = NULL;
res = mono_message_invoke (ares->async_delegate, ac->msg, &exc, &out_args);
MONO_OBJECT_SETREF (ac, res, res);
MONO_OBJECT_SETREF (ac, msg->exc, exc);
MONO_OBJECT_SETREF (ac, out_args, out_args);
mono_monitor_enter ((MonoObject *) ares);
ares->completed = 1;
if (ares->handle != NULL)
wait_event = mono_wait_handle_get_handle ((MonoWaitHandle *) ares->handle);
mono_monitor_exit ((MonoObject *) ares);
/* notify listeners */
if (wait_event != NULL)
SetEvent (wait_event);
/* call async callback if cb_method != null*/
if (ac != NULL && ac->cb_method) {
void *pa = &ares;
cb_exc = NULL;
mono_runtime_invoke (ac->cb_method, ac->cb_target, pa, &cb_exc);
MONO_OBJECT_SETREF (ac->msg, exc, cb_exc);
exc = cb_exc;
} else {
exc = NULL;
}
}
/* restore original thread execution context if flow isn't suppressed, i.e. non null */
if (ares->original_context) {
mono_thread_set_execution_context (ares->original_context);
ares->original_context = NULL;
}
return exc;
}
示例3: create_simple_asyncresult
static MonoAsyncResult *
create_simple_asyncresult (MonoObject *target, MonoObject *state)
{
MonoDomain *domain = mono_domain_get ();
MonoAsyncResult *ares;
/* Don't call mono_async_result_new() to avoid capturing the context */
ares = (MonoAsyncResult *) mono_object_new (domain, mono_defaults.asyncresult_class);
MONO_OBJECT_SETREF (ares, async_delegate, target);
MONO_OBJECT_SETREF (ares, async_state, state);
return ares;
}
示例4: mono_mlist_prepend
/**
* mono_mlist_prepend:
* @list: the managed list
* @data: the object to add to the list
*
* Allocate a new list node with @data as content and prepend it
* to the list @list. @list can be NULL.
*/
MonoMList*
mono_mlist_prepend (MonoMList* list, MonoObject *data)
{
MonoMList* res = mono_mlist_alloc (data);
if (list)
MONO_OBJECT_SETREF (res, next, list);
return res;
}
示例5: mono_declsec_create_frame
MonoSecurityFrame*
mono_declsec_create_frame (MonoDomain *domain, MonoJitInfo *jinfo)
{
MonoSecurityFrame *frame = (MonoSecurityFrame*) mono_object_new (domain, mono_defaults.runtimesecurityframe_class);
MonoMethodCasInfo *info;
MonoMethod *method;
method = jinfo_get_method (jinfo);
info = mono_jit_info_get_cas_info (jinfo);
if (info && !info->cas_inited) {
if (mono_method_has_declsec (method)) {
/* Cache the stack modifiers into the MonoJitInfo structure to speed up future stack walks */
mono_declsec_cache_stack_modifiers (jinfo);
}
info->cas_inited = TRUE;
}
MONO_OBJECT_SETREF (frame, method, mono_method_get_object (domain, method, NULL));
MONO_OBJECT_SETREF (frame, domain, domain->domain);
/* stack modifiers on methods have priority on (i.e. replaces) modifiers on class */
if (info && info->cas_method_assert) {
mono_declsec_get_method_action (method, SECURITY_ACTION_ASSERT, &frame->assert);
} else if (info && info->cas_class_assert) {
mono_declsec_get_class_action (method->klass, SECURITY_ACTION_ASSERT, &frame->assert);
}
if (info && info->cas_method_deny) {
mono_declsec_get_method_action (method, SECURITY_ACTION_DENY, &frame->deny);
} else if (info && info->cas_class_deny) {
mono_declsec_get_class_action (method->klass, SECURITY_ACTION_DENY, &frame->deny);
}
if (info && info->cas_method_permitonly) {
mono_declsec_get_method_action (method, SECURITY_ACTION_PERMITONLY, &frame->permitonly);
} else if (info && info->cas_class_permitonly) {
mono_declsec_get_class_action (method->klass, SECURITY_ACTION_PERMITONLY, &frame->permitonly);
}
/* g_warning ("FRAME %s A(%p,%d) D(%p,%d) PO(%p,%d)",
method->name, frame->assert.blob, frame->assert.size, frame->deny.blob, frame->deny.size, frame->permitonly.blob,frame->permitonly.size); */
return frame;
}
示例6: mono_mlist_set_next
/**
* mono_mlist_set_next:
* @list: a managed list node
* @next: list node that will be next for the @list node.
*
* Set next node for @list to @next.
*/
MonoMList *
mono_mlist_set_next (MonoMList* list, MonoMList *next)
{
if (!list)
return next;
MONO_OBJECT_SETREF (list, next, next);
return list;
}
示例7: set_message_on_exception
static void
set_message_on_exception (MonoException *exception, MonoErrorInternal *error, MonoError *error_out)
{
MonoString *msg = mono_string_new (mono_domain_get (), error->full_message);
if (msg)
MONO_OBJECT_SETREF (exception, message, msg);
else
mono_error_set_out_of_memory (error_out, "Could not allocate exception object");
}
示例8: mono_get_exception_runtime_wrapped
MonoException *
mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception)
{
MonoRuntimeWrappedException *ex = (MonoRuntimeWrappedException*)
mono_exception_from_name (mono_get_corlib (), "System.Runtime.CompilerServices",
"RuntimeWrappedException");
MONO_OBJECT_SETREF (ex, wrapped_exception, wrapped_exception);
return (MonoException*)ex;
}
示例9: mono_mlist_append
/**
* mono_mlist_append:
* @list: the managed list
* @data: the object to add to the list
*
* Allocate a new list node with @data as content and append it
* to the list @list. @list can be NULL.
* Since managed lists are singly-linked, this operation takes O(n) time.
*/
MonoMList*
mono_mlist_append (MonoMList* list, MonoObject *data)
{
MonoMList* res = mono_mlist_alloc (data);
if (list) {
MonoMList* last = mono_mlist_last (list);
MONO_OBJECT_SETREF (last, next, res);
return list;
} else {
return res;
}
}
示例10: mono_exception_from_name_msg
/**
* mono_exception_from_name_msg:
* @image: the Mono image where to look for the class
* @name_space: the namespace for the class
* @name: class name
* @msg: the message to embed inside the exception
*
* Creates an exception and initializes its message field.
*
* Returns: the initialized exception instance.
*/
MonoException *
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
const char *name, const char *msg)
{
MonoException *ex;
ex = mono_exception_from_name (image, name_space, name);
if (msg)
MONO_OBJECT_SETREF (ex, message, mono_string_new (mono_object_get_domain ((MonoObject*)ex), msg));
return ex;
}
示例11: ves_icall_System_Globalization_CompareInfo_assign_sortkey
void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this_obj, MonoSortKey *key, MonoString *source, gint32 options)
{
MonoArray *arr;
gint32 keylen, i;
keylen=mono_string_length (source);
arr=mono_array_new (mono_domain_get (), mono_get_byte_class (),
keylen);
for(i=0; i<keylen; i++) {
mono_array_set (arr, guint8, i, mono_string_chars (source)[i]);
}
MONO_OBJECT_SETREF (key, key, arr);
}
示例12: mono_mlist_alloc
/**
* mono_mlist_alloc:
* @data: object to use as data
*
* Allocates a new managed list node with @data as the contents.
* A managed list node also represents a singly-linked list.
* Managed lists are garbage collected, so there is no free routine
* and the user is required to keep references to the managed list
* to prevent it from being garbage collected.
*/
MonoMList*
mono_mlist_alloc (MonoObject *data)
{
MonoError error;
MonoMList* res;
if (!monolist_item_vtable) {
MonoClass *klass = mono_class_from_name (mono_defaults.corlib, "System", "MonoListItem");
monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass);
g_assert (monolist_item_vtable);
}
res = (MonoMList*)mono_object_new_fast_checked (monolist_item_vtable, &error);
mono_error_raise_exception (&error);
MONO_OBJECT_SETREF (res, data, data);
return res;
}
示例13: mono_get_exception_argument_out_of_range
/**
* mono_get_exception_argument_out_of_range:
* @arg: the name of the out of range argument.
*
* Returns: a new instance of the `System.ArgumentOutOfRangeException`
*/
MonoException *
mono_get_exception_argument_out_of_range (const char *arg)
{
MonoException *ex;
ex = mono_exception_from_name (
mono_get_corlib (), "System", "ArgumentOutOfRangeException");
if (arg) {
MonoArgumentException *argex = (MonoArgumentException *)ex;
MONO_OBJECT_SETREF (argex, param_name, mono_string_new (mono_object_get_domain ((MonoObject*)ex), arg));
}
return ex;
}
示例14: mono_threadpool_ms_enqueue_async_result
void
mono_threadpool_ms_enqueue_async_result (MonoDomain *domain, MonoAsyncResult *ares)
{
static MonoClass *runtime_work_item_class = NULL;
MonoRuntimeWorkItem *rwi;
g_assert (ares);
if (!runtime_work_item_class)
runtime_work_item_class = mono_class_from_name (mono_defaults.corlib, "System.Threading", "MonoRuntimeWorkItem");
g_assert (runtime_work_item_class);
rwi = (MonoRuntimeWorkItem*) mono_object_new (domain, runtime_work_item_class);
MONO_OBJECT_SETREF (rwi, async_result, ares);
mono_threadpool_ms_enqueue_work_item (domain, (MonoObject*) rwi);
}
示例15: mono_mlist_remove_item
/**
* mono_mlist_remove_item:
* @list: the managed list
* @data: the object to remove from the list
*
* Remove the list node @item from the managed list @list.
* Since managed lists are singly-linked, this operation can take O(n) time.
*/
MonoMList*
mono_mlist_remove_item (MonoMList* list, MonoMList *item)
{
MonoMList* prev;
if (list == item) {
list = item->next;
item->next = NULL;
return list;
}
prev = find_prev (list, item);
if (prev) {
MONO_OBJECT_SETREF (prev, next, item->next);
item->next = NULL;
return list;
} else {
/* not found */
return list;
}
}