Example #1
0
        /// <summary>Get the thread identifier for the specified thread.</summary>
/// <remarks>Equivalent to SDL_ThreadID() if the specified thread is NULL.</remarks>
        public static uint GetThreadID(global::SharpSDL.Thread thread)
        {
            var __arg0 = ReferenceEquals(thread, null) ? global::System.IntPtr.Zero : thread.__Instance;
            var __ret  = __Internal.GetThreadID(__arg0);

            return(__ret);
        }
Example #2
0
        /// <summary>
/// <para>Get the thread name, as it was specified in SDL_CreateThread().</para>
/// <para>This function returns a pointer to a UTF-8 string that names the</para>
/// <para>specified thread, or NULL if it doesn't have a name. This is internal</para>
/// <para>memory, not to be free()'d by the caller, and remains valid until the</para>
/// <para>specified thread is cleaned up by SDL_WaitThread().</para>
/// </summary>
        public static string GetThreadName(global::SharpSDL.Thread thread)
        {
            var __arg0 = ReferenceEquals(thread, null) ? global::System.IntPtr.Zero : thread.__Instance;
            var __ret  = __Internal.GetThreadName(__arg0);

            return(Marshal.PtrToStringAnsi(__ret));
        }
Example #3
0
        /// <summary>
/// <para>Wait for a thread to finish. Threads that haven't been detached will</para>
/// <para>remain (as a &quot;zombie&quot;) until this function cleans them up. Not doing so</para>
/// <para>is a resource leak.</para>
/// </summary>
/// <remarks>
/// <para>Once a thread has been cleaned up through this function, the SDL_Thread</para>
/// <para>that references it becomes invalid and should not be referenced again.</para>
/// <para>As such, only one thread may call SDL_WaitThread() on another.</para>
/// <para>The return code for the thread function is placed in the area</para>
/// <para>pointed to byifis not NULL.</para>
/// <para>You may not wait on a thread that has been used in a call to</para>
/// <para>SDL_DetachThread(). Use either that function or this one, but not</para>
/// <para>both, or behavior is undefined.</para>
/// <para>It is safe to pass NULL to this function; it is a no-op.</para>
/// </remarks>
        public static void WaitThread(global::SharpSDL.Thread thread, ref int status)
        {
            var __arg0 = ReferenceEquals(thread, null) ? global::System.IntPtr.Zero : thread.__Instance;

            fixed(int *__status1 = &status)
            {
                var __arg1 = __status1;

                __Internal.WaitThread(__arg0, __arg1);
            }
        }
Example #4
0
        /// <summary>
/// <para>A thread may be &quot;detached&quot; to signify that it should not remain until</para>
/// <para>another thread has called SDL_WaitThread() on it. Detaching a thread</para>
/// <para>is useful for long-running threads that nothing needs to synchronize</para>
/// <para>with or further manage. When a detached thread is done, it simply</para>
/// <para>goes away.</para>
/// </summary>
/// <remarks>
/// <para>There is no way to recover the return code of a detached thread. If you</para>
/// <para>need this, don't detach the thread and instead use SDL_WaitThread().</para>
/// <para>Once a thread is detached, you should usually assume the SDL_Thread isn't</para>
/// <para>safe to reference again, as it will become invalid immediately upon</para>
/// <para>the detached thread's exit, instead of remaining until someone has called</para>
/// <para>SDL_WaitThread() to finally clean it up. As such, don't detach the same</para>
/// <para>thread more than once.</para>
/// <para>If a thread has already exited when passed to SDL_DetachThread(), it will</para>
/// <para>stop waiting for a call to SDL_WaitThread() and clean up immediately.</para>
/// <para>It is not safe to detach a thread that might be used with SDL_WaitThread().</para>
/// <para>You may not call SDL_WaitThread() on a thread that has been detached.</para>
/// <para>Use either that function or this one, but not both, or behavior is</para>
/// <para>undefined.</para>
/// <para>It is safe to pass NULL to this function; it is a no-op.</para>
/// </remarks>
        public static void DetachThread(global::SharpSDL.Thread thread)
        {
            var __arg0 = ReferenceEquals(thread, null) ? global::System.IntPtr.Zero : thread.__Instance;

            __Internal.DetachThread(__arg0);
        }