This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_semaphore_t semaphore = dispatch_semaphore_create(1); | |
// Then in some loop ... | |
if(dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW) == 0) { | |
dispatch_async(queue, ^{ | |
// Some code that needs to run but doesn't need to fill up the queue. | |
// | |
dispatch_semaphore_signal(semaphore); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style></style> | |
<body> | |
<div id="bar-demo"></div> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script> | |
// now moving onto books read per year | |
// set up an array of the data |