File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
var q = require ( 'queue-async' ) ,
2
+ fifo = require ( 'fifolock' ) ,
2
3
stream = require ( 'stream' ) ,
3
4
util = require ( 'util' ) ,
4
5
events = require ( 'events' ) ,
5
6
SPI = require ( 'pi-spi' ) ,
6
7
GPIO = require ( 'pi-pins' ) ,
7
8
_m = require ( "./magicnums" ) ;
8
9
9
- function forEachWithCB ( fn , cb ) {
10
+ var mutex = fifo ( ) ; // HACK: avoid https://github.com/natevw/node-nrf/commit/8d80dabde1026e949f4eb4ea6d25624cbf3c70ec
11
+ function forEachWithCB ( fn , cb ) { cb = mutex . TRANSACTION_WRAPPER ( cb , function ( ) {
10
12
var process = q ( 1 ) ;
11
13
this . forEach ( function ( d ) { process . defer ( fn , d ) ; } ) ;
12
14
process . awaitAll ( cb ) ;
13
- } ;
15
+ } . bind ( this ) ) ; }
14
16
15
17
function _extend ( obj ) {
16
18
for ( var i = 1 , len = arguments . length ; i < len ; i ++ ) {
Original file line number Diff line number Diff line change 24
24
"url" : " https://github.com/natevw/node-nrf/issues"
25
25
},
26
26
"dependencies" : {
27
+ "fifolock" : " ^1.0.0" ,
28
+ "pi-pins" : " ^1.0.0" ,
27
29
"pi-spi" : " ~0.8.1" ,
28
- "queue-async" : " ~1.0.4" ,
29
- "pi-pins" : " ^1.0.0"
30
+ "queue-async" : " ~1.0.4"
30
31
}
31
32
}
You can’t perform that action at this time.
0 commit comments