The AVM2.h header file contains various low-level FlasCC-specific utility functions and macros.
Function | Description |
__avm2_apply_args
| - #define __avm2_apply_args()
复制代码Returns a pointer to data describing how to perform a call with the same arguments as were passed to the current function. |
__avm2_apply
| - #define __avm2_apply(function, arguments, size)
复制代码Invokes function with a copy of the parameters described by arguments and size. Parameters: - function - The function to be invoked.
- arguments - The arguments to be passed. This should be the value returned by __avm2_apply_args().
- size - The number of bytes in the stack argument data.
|
__avm2_return
| - #define __avm2_return(result)
复制代码Returns the value described by result from the containing function. Parameters: - result - The value returned by __avm2_apply.
|
__builtin_va_arg_pack
| - #define __builtin_va_arg_pack
复制代码Error. Not supported in FlasCC. |
__builtin_va_arg_pack_len
| - #define __builtin_va_arg_pack_len
复制代码Error. Not supported in FlasCC. |
__builtin_apply_args
| - <span style="color: rgb(221, 17, 68); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; line-height: 20px; white-space: nowrap; background-color: rgb(247, 247, 249);">__avm2_apply_args</span>
复制代码overrides |
__builtin_apply
| - <span style="color: rgb(221, 17, 68); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; line-height: 20px; white-space: nowrap; background-color: rgb(247, 247, 249);">__avm2_apply</span>
复制代码overrides |
__builtin_return
| - <span style="color: rgb(221, 17, 68); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; line-height: 20px; white-space: nowrap; background-color: rgb(247, 247, 249);">__avm2_return</span>
复制代码overrides |
avm2_locked_id
| - unsigned avm2_locked_id(unsigned *mtx);
复制代码Returns the id of the lock owner. Low-level concurrency primitives -- expect hangs or worse if not used properly. Non-recursive mutexes. Parameters: - mtx - ID of lock owner or 0.
|
avm2_lock
| - void avm2_lock(unsigned *mtx);
复制代码Low-level concurrency primitives -- expect hangs or worse if not used properly. Non-recursive mutexes. Parameters: - mtx - lock with thread id.
|
avm2_lock_id
| - void avm2_lock_id(unsigned *mtx, unsigned id);
复制代码Low-level concurrency primitives -- expect hangs or worse if not used properly. Non-recursive mutexes. Parameters: - mtx - lock with any non-0 value.
- id - lock owner id.
|
avm2_unlock
| - void avm2_unlock(unsigned *mtx);
复制代码Super low-level concurrency primitives -- expect hangs or worse if not used properly. Non-recursive mutexes. Parameters: |
Address token-based conditions |
avm2_msleep
| - int avm2_msleep(void *addr, unsigned *mtx, int timo);
复制代码Waits for addr to be woken for timo milliseconds (or forever if timo==0). Releases mutex on entry, re-acquired before return 0 on timeout, non-zero on wake. Parameters: - addr - Sleep on address.
- mtx - Must be locked on entry.
- timo - Number of milliseconds this function waits for addr to be woken (forever if timo==0).
|
avm2_wake
| - int avm2_wake(void *addr);
复制代码Wake any threads msleeping on addr, returns non-zero if a thread was woken. Parameters: - addr - Address pointing to sleeping threads.
Example Usage: |
avm2_wake_one
| - int avm2_wake_one(void *addr);
复制代码Wake zero (if none msleeping on addr) or one threads msleeping on addr, returns non-zero if any thread was woken. Parameters: - addr - Address pointing to sleeping threads.
|
avm2_thr_impersonate
| - void *avm2_thr_impersonate(long tid, void *(*proc)(void *), void *arg);
复制代码Call proc(arg) while impersonating the thread specified by tid. Parameters: - tid - Long containing the thread to impersonate.
- proc - The function pointer.
- arg - The data to pass to the function pointer.
|
avm2_ui_thunk
| - void *avm2_ui_thunk(void *(*proc)(void *), void *arg);
复制代码Call proc(arg) on the UI Worker as calling thread. Parameters: - proc - The function pointer.
- arg - The data to pass to the function pointer.
|
avm2_is_ui_worker
| Returns non-zero if running on the UI Worker. |
avm2_wait_for_ui_frame
| - int avm2_wait_for_ui_frame(int timo);
复制代码Wait for a frame event or until timeout. Returns 0 on timeout. Parameters: - timo - A timeout interval, in milliseconds.
|
avm2_self_lock
| Lock this thread to this Worker -- recursive OK. |
avm2_self_unlock
| Unlock this thread. |
avm2_self_msleep
| - int avm2_self_msleep(void *addr, int timo);
复制代码Works like avm2_msleep with mtx being "self" -- "self" must be locked using avm2_self_lock. Parameters: - addr - Sleep on address.
- timo - Number of milliseconds this function waits for addr to be woken (forever if timo==0).
Example Usage: |
avm2_tramp_alloc
| - void *avm2_tramp_alloc(void *funPtr, int sret, void *arg0, void *arg1);
复制代码Trampoline support. For more information, see sdk/usr/share/avm2_tramp.cpp. Parameters: - funPtr - Function pointer.
- sret - Size of the structure return type for POD or the negative size of the structure for non-POD. Must be zero for a non-structure return type.
- arg0 - First argument.
- arg1 - Second argument.
|
avm2_tramp_free
| - void avm2_tramp_free(void *trampFunPtr);
复制代码Trampoline support. For more information, see sdk/usr/share/avm2_tramp.cpp. Parameters: - trampFunPtr - Function pointer to be freed.
|