Ryujinx-GtkSharp/glib/Mutex.cs
Stephan Sundermann 112e2b9598 generator,glib: Added Mutex, RecMutex, Cond types
Bind these types manually and added generator support
for them.
2013-10-09 13:09:34 +02:00

111 lines
3.9 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
// TODO: generate this as part of the build instead of committing it to the repo
namespace GLib {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#region Autogenerated code
[StructLayout(LayoutKind.Explicit)]
public partial struct Mutex : IEquatable<Mutex> {
[FieldOffset(0)]
private IntPtr _p;
[FieldOffset(0)]
[MarshalAs (UnmanagedType.ByValArray, SizeConst=2)]
public uint[] I;
public static GLib.Mutex Zero = new GLib.Mutex ();
public static GLib.Mutex New(IntPtr raw) {
if (raw == IntPtr.Zero)
return GLib.Mutex.Zero;
return (GLib.Mutex) Marshal.PtrToStructure (raw, typeof (GLib.Mutex));
}
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_mutex_clear(IntPtr raw);
public void Clear() {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
g_mutex_clear(this_as_native);
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
}
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_mutex_init(IntPtr raw);
public void Init() {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
g_mutex_init(this_as_native);
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
}
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_mutex_lock(IntPtr raw);
public void Lock() {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
g_mutex_lock(this_as_native);
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
}
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool g_mutex_trylock(IntPtr raw);
public bool Trylock() {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
bool raw_ret = g_mutex_trylock(this_as_native);
bool ret = raw_ret;
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
return ret;
}
[DllImport("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_mutex_unlock(IntPtr raw);
public void Unlock() {
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
g_mutex_unlock(this_as_native);
ReadNative (this_as_native, ref this);
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
}
static void ReadNative (IntPtr native, ref GLib.Mutex target)
{
target = New (native);
}
public bool Equals (Mutex other)
{
return true && _p.Equals (other._p) && I.Equals (other.I);
}
public override bool Equals (object other)
{
return other is Mutex && Equals ((Mutex) other);
}
public override int GetHashCode ()
{
return this.GetType().FullName.GetHashCode() ^ _p.GetHashCode () ^ I.GetHashCode ();
}
#endregion
}
}