Skip to content

Attensi/ActionQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

ActionQueue queue = new ActionQueue();
queue.addAction(() => {
  // Code to run
});

File access queue

Writing
ActionQueue fileAccessQueue = new ActionQueue();

fileAccessQueue.AddAction(() => {
  using (StreamWriter w = File.AppendText(filename))
  {
      w.WriteLine(content);
  }
});
Reading
string content = "";

Task t = fileAccessQueue.AddAction(() => {
  content = File.ReadAllText(filename);
});

Task.WaitAll(t); // wait for any reading/writing actions in queue

return content;

About

Library to queue actions on backgound threads

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages