Code Monkey home page Code Monkey logo

threadily's People

Contributors

k2snowman69 avatar

Watchers

 avatar  avatar  avatar

threadily's Issues

Observable Arrays only work with primatives... they do not work with ThreadObjects

Try running this unit test

        TEST_METHOD(ThreadObject_Observable_Vector_ThreadObject)
        {
            auto threadManager = std::make_shared<ThreadManager>();
            threadManager->getOrCreateThread(ThreadIds::Service, std::set<unsigned int>({ ThreadIds::App }));
            threadManager->getOrCreateThread(ThreadIds::App, std::set<unsigned int>({ ThreadIds::UI }));
            threadManager->getOrCreateThread(ThreadIds::UI);

            auto threadObjectManager = std::make_shared<ThreadObjectManager<ParentThreadObject>>(threadManager);
            auto childThreadObjectManager = std::make_shared<ThreadObjectManager<ExampleThreadObject>>(threadManager);
            auto threadObject_UI = threadObjectManager->getOrCreateObject(ThreadIds::UI, 0);
            auto threadObject_Service = threadObjectManager->getOrCreateObject(ThreadIds::Service, 0);

            // set up a waiter until we get a notification on the UI thread that something has been completed
            ReadyEvent e;
            auto subscribeHandle = threadObject_UI->exampleObjects->subscribe([&e](std::shared_ptr<ExampleThreadObject> newValue, size_t index, ObservableActionType action)
            {
                e.finished();
            });

            auto sizeBefore = threadObject_UI->exampleObjects->size();

            auto newChildObject = childThreadObjectManager->getOrCreateObject(ThreadIds::Service, 4);
            newChildObject->name->set(L"new name");
            threadObject_Service->exampleObjects->insert(0, newChildObject);
            e.wait();

            Assert::IsTrue(nullptr != threadObject_UI->exampleObjects->at(0), L"Make sure the UI object was set");
            Assert::IsTrue(threadObject_UI->exampleObjects->size() == sizeBefore + 1, L"Expect example objects list to be size of 1");
            Assert::IsTrue(ThreadIds::UI == threadObject_UI->exampleObjects->at(0)->getThreadId(), L"Expected the example object to be running on the UI thread");
            Assert::IsTrue(ThreadIds::Service == threadObject_Service->exampleObjects->at(0)->getThreadId(), L"Expected the example object to be running on the Service thread");
            Assert::AreEqual(threadObject_UI->exampleObjects->at(0)->getId(), threadObject_Service->exampleObjects->at(0)->getId(), L"Make sure they have the same value");
            Assert::IsTrue(threadObject_UI->exampleObjects->at(0).get() != threadObject_Service->exampleObjects->at(0).get(), L"Make sure they are two distinct pointers");
            Assert::AreEqual(threadObject_UI->exampleObjects->at(0)->name->get(), threadObject_Service->exampleObjects->at(0)->name->get(), L"Make sure they have the same name value");
        }

Id needs to be more flexible

Currently Id is required to be a unsigned integer. Some objects may have multiple reference id's of which make up the id and that needs to be represented in the system.

Strong pointer issues with Observable<vector<T>>

There seems to be some strong pointer reference issues regarding contents of a Observable<vector>. I think writing some tests that verify the expected strong pointer reference count wouldn't be a bad idea to add to the system.

Need to be able to pass current thread context for Windows

Windows requires all UI updates to happen on the main thread. We need a way to be able to provide this thread to threadily when it's creating the UI thread. I think the code was written but we don't have tests verifying that it works, if it works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.