src: migrate pthreads to uv_threads

- So it can be compatible in every platform supported by libuv.
- Use attached threads instead of detached.
- Remove all CardReader 'status' listeners before emitting the
  'end' event.
This commit is contained in:
Santiago Gimeno
2014-08-08 16:30:12 +02:00
parent da61bae08a
commit 0c5e07e0e5
6 changed files with 112 additions and 61 deletions

View File

@@ -59,6 +59,11 @@ module.exports = function() {
r.state = state;
});
r.on('_end', function() {
r.removeAllListeners('status');
r.emit('end');
});
p.emit('reader', r);
});
});
@@ -102,7 +107,6 @@ CardReader.prototype.disconnect = function(disposition, cb) {
};
CardReader.prototype.transmit = function(data, res_len, protocol, cb) {
if (!this.connected) {
return cb(new Error("Card Reader not connected"));
}