Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Abstract libuv #3139

Merged
merged 25 commits into from
Dec 1, 2015
Merged

[core] Abstract libuv #3139

merged 25 commits into from
Dec 1, 2015

Conversation

tmpsantos
Copy link
Contributor

This branch reduces the delta between master and the Qt branch that is under development. It enables the platform to reimplement the main loop and get rid of libuv in favor of, say, glib or the Qt main loop.

Wrapping is mostly done by reusing existing util:: like util::Thread and also by 3 new classes:

  • AsyncTask: Send asynchronous messages to the main loop where the AsyncTask object lives, coalescing multiple messages.
  • Timer: an ordinary timer.
  • RunLoop: not exactly new but was refactored to allow reimplementation. Consists of a platform main loop, using AsyncTask internally for waking up.

All these new classes were implemented in a way to be almost a drop-in replacement for the libuv counterparts, making the changes as mild as possible. AssetFS and AssetZIP are exceptions, as they were heavily refactored to use util::Thread for doing threaded file I/O instead of libuv workers.

For all the newly introduced classes, unit tests were also added and in some cases, like for the AssetZIP, broken unit tests were fixed and more were added.

This PR also is also a enabler for #2909.

@tmpsantos
Copy link
Contributor Author

👀 @kkaefer @brunoabinader @jfirebaugh

@tmpsantos tmpsantos force-pushed the tmpsantos-libuv_abstracted branch 3 times, most recently from 5bb52db to c95c4ba Compare November 30, 2015 14:09
@@ -39,6 +39,10 @@
],
},

'include_dirs': [
'../src',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this necessary for? IIRC, we want to use the apps partly as as examples, which means they should avoid using internal includes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one slipped. Removing.

It was being used as a normal mutex anyway.
Moved the fd watcher to the RunLoop. So far only needs to
be implemented by platforms using HTTPCurlRequest et al.
ASSET=zip make test-* was broken and now works.

Also added a test stressing concurrent file access.
Now only a few things depend on libuv and they can use it directly.
Also simplified the code making the logic more linear.
@tmpsantos tmpsantos merged commit e7b6d72 into master Dec 1, 2015
@mourner mourner removed the ready label Dec 1, 2015
@tmpsantos tmpsantos deleted the tmpsantos-libuv_abstracted branch December 1, 2015 10:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants