Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.FNAThreading.SyncContext Class Reference
+ Inheritance diagram for Terraria.ModLoader.FNAThreading.SyncContext:
+ Collaboration diagram for Terraria.ModLoader.FNAThreading.SyncContext:

Public Member Functions

override SynchronizationContext CreateCopy ()
 
override void Post (SendOrPostCallback d, object state)
 
override void Send (SendOrPostCallback d, object state)
 

Static Private Attributes

static ConcurrentQueue< Action > actions = new ConcurrentQueue<Action>()
 

Detailed Description

Definition at line 9 of file FNAThreading.cs.

Member Function Documentation

override SynchronizationContext Terraria.ModLoader.FNAThreading.SyncContext.CreateCopy ( )

Definition at line 44 of file FNAThreading.cs.

44  {
45  return this;
46  }
override void Terraria.ModLoader.FNAThreading.SyncContext.Post ( SendOrPostCallback  d,
object  state 
)

Definition at line 33 of file FNAThreading.cs.

33  {
34  actions.Enqueue(() => {
35  try {
36  d.Invoke(state);
37  }
38  catch (Exception e) {
39  Logging.tML.Error("Posted event", e);
40  }
41  });
42  }
static ConcurrentQueue< Action > actions
Definition: FNAThreading.cs:11
override void Terraria.ModLoader.FNAThreading.SyncContext.Send ( SendOrPostCallback  d,
object  state 
)

Definition at line 13 of file FNAThreading.cs.

13  {
14  var handle = new ManualResetEvent(false);
15  Exception e = null;
16  actions.Enqueue(() => {
17  try {
18  d.Invoke(state);
19  }
20  catch (Exception e2) {
21  e = e2;
22  }
23  finally {
24  handle.Set();
25  }
26  });
27 
28  handle.WaitOne();
29  if (e != null)
30  throw e;
31  }
static ConcurrentQueue< Action > actions
Definition: FNAThreading.cs:11

Member Data Documentation

ConcurrentQueue<Action> Terraria.ModLoader.FNAThreading.SyncContext.actions = new ConcurrentQueue<Action>()
staticprivate

Definition at line 11 of file FNAThreading.cs.