Simple personal site made with Angular 2
domfarolino / base Goto Github PK
View Code? Open in Web Editor NEW🧱 A simple threading and scheduling library with I/O support
🧱 A simple threading and scheduling library with I/O support
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.
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:
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.