1 jls.loader.provide('jls.net.PollableEvent'); 2 3 jls.loader.requireLibrary('jls_net'); 4 5 //jls.net.PollableEvent = _native.net.PollableEvent; 6 7 jls.net.PollableEvent = jls.lang.Class.create( /** @lends jls.net.PollableEvent.prototype */ 8 { 9 /** 10 * Creates a pollable event. 11 * 12 * @constructs 13 * @class This class represents a special kind of file descriptor. 14 * The only I/O operation you can perform on a pollable event is to select it with the OP_READ flag. 15 * You cannot read from or write to a pollable event. 16 */ 17 initialize : function() { 18 this._event = new _native.net.PollableEvent(); 19 }, 20 /** 21 * Closes this pollable event. 22 * 23 * @returns {jls.net.PollableEvent} This pollable event. 24 */ 25 close : function() { 26 this._event.close(); 27 return this; 28 }, 29 /** 30 * Sets this pollable event. 31 * 32 * @returns {jls.net.PollableEvent} This pollable event. 33 */ 34 set : function() { 35 this._event.set(); 36 return this; 37 }, 38 /** 39 * Blocks the calling thread until the pollable event is set. 40 * 41 * @returns {jls.net.PollableEvent} This pollable event. 42 */ 43 wait : function() { 44 this._event.wait(); 45 return this; 46 }, 47 getFD : function() { 48 return this._event; 49 } 50 }); 51