From f34b200979e7127d3a0ed7f0487d9eb505672f05 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 23 Jun 2017 17:10:01 -0400 Subject: [PATCH] Fixed a bug in multi.threadinng still had a reference to require("multi.updater") changed to require("multi") since the core now has the basic objects! Also Starting work on love2d systemthreads! --- multi/intergration/loveManager.lua | 15 +++++++++++++++ multi/threading.lua | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 multi/intergration/loveManager.lua diff --git a/multi/intergration/loveManager.lua b/multi/intergration/loveManager.lua new file mode 100644 index 0000000..8657d3f --- /dev/null +++ b/multi/intergration/loveManager.lua @@ -0,0 +1,15 @@ +--[[ +This is going to be fun. With love2d channels are easy to get but the way they work are very different from lanes' +Channels work like a queue so in order to recreate the global table we would have to do some very weird things... + +First off every thread can share a channel thats the same, but once one thread eats the value it isn't availible for the rest... You can peek but then you would have to convey that to the other threads +The way the structure of threading works in love2d makes you not want to have a thread that is constantly running because data passing in a nice way is tricky. + +The idea that love took prevents data errors, but a global table is something that needs to be implemted so basic libraries +that use the multi library threading ablities are cross platform. + +Idea 1: +One method could be to have a read channel that all data is sent through. +The first thread that gets it using Channel:performAtomic() takes that data keeps a copy for its Global then sends a copy to the other threads individual global channel +basically an updater that updates a local table. +]] diff --git a/multi/threading.lua b/multi/threading.lua index 42070ce..4c0397a 100644 --- a/multi/threading.lua +++ b/multi/threading.lua @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -require("multi.updater") +require("multi") thread={} multi.GlobalVariables={} if os.getOS()=="windows" then