Threads and shared memory

Home Forums Mods and POG Scripting Threads and shared memory

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #14319
    GrandpaTrout
    Participant

    I wrote a small program to test some theories about how memory is shared between threads. The SDK states that threads have seperate memory, and cannot share.

    But it does not comment on how globals are handled. Or how groups are handled. Tasks often want to move around groups of ships, or lists of objects.

    I found some surprising results:
    Both lists and groups can be shared between tasks.

    I created a list and group in a first task, added some items, and then placed both into globals. (The group in a global handle).

    I then used a second task to look at list and group and see if the items were there. They were. I then added another item.

    I then used the first task to check if the new items showed up. They did.

    I did not expect that groups could be used to share, because you must “create” a group (thus allocating memory). But it seems to work. This contradicts earlier findings – so I am betting it breaks in weird and unexpected ways.

    Full source and package file here:

    http://www.i-war2.com/epic/files/MemTest.zip

    -Gtrout

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.