Giter Club home page Giter Club logo

base's Introduction

domfarolino

MIT license Dependency Status devDependency Status

Simple personal site made with Angular 2

logo

base's People

Contributors

domfarolino avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

base's Issues

base::SetIOThreadTaskLoop and base::GetIOThreadTaskLoop should specifically deal with base::TaskLoopForIO

Currently base::SetIOThreadTaskLoop() and base::GetIOThreadTaskLoop() deal only with the base class base::TaskLoop. However, consumers of base::GetIOThreadTaskLoop() (like mage) are eventually going to rely on it returning a base::TaskLoopForIO, so it can use the specific base::TaskLoopForIO methods that are not provided by just a plain old base::TaskLoop.

Until we fix this, all users of base::GetIOThreadTaskLoop() are going to have to statically cast the return TaskLoop into a TaskLoopForIO in order to use IO-specific methods, like registering a socket reader etc.

We could fix this right now, but it would involve putting even platform-specific #ifdefs in the code Linux doesn't support TaskLoopForIO yet. Instead we should consider this blocked on domfarolino/browser#33 so that we can remove all platform-specific #ifdefs around TaskLoopForIO usages, and fix this trivial bug.

Synchronize access to base::Thread::delegate_

Anyone can take this if they'd like. Basically base::Thread::delegate_ is accessed on multiple threads but is not protected by a mutex or anything, which is a little sketchy. I'm pretty sure there are no problems with the current code, but we should:

  1. Synchronize access to the variable anyways to be safe
  2. Do a kinda deep-dive to see if there is any way to exploit the current code to cause a bug, and if so, consider writing a test that would expose the bug, but that would pass after (1). I say "consider" writing a test because in order to actually write the test to deterministically exploit a subtle race condition it might require some weird test-specific hooks which might not be worth implementing. But we should find out for sure.

Allow for queueing tasks on a thread before it is started

base::Thread does not create its Thread::Delegate until Start() is called on the thread. Because of this, base::Thread::GetTaskRunner() will crash, which in itself is fine (you just need to be sure to know that you can't do this in practice). But the real issue is that you can't actually queue tasks until you call thread.Start(), which is annoying.

I think it would be a better design if we allowed for the queueing of tasks on a thread that has not yet started. This would also allow us to better-exercise the task queueing/execution infra in tests, since we could verify that multiple queued tasks (even of different types) are executed back-to-back, and not accidentally held-up behind each other.

To accomplish this, I think Thread should eagerly create its Thread::Delegate, which would allow us to get task runners synchronously after a Thread is created. It might be as easy as that... but then again it might not be.

If someone is interested in taking this, go for it! Otherwise, I will at some point. cc @pmusgrave

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.