static void Main(String[] args) { LBMContext ctx = null; /* Context object: container for UM "instance". */ /*** Initialization: create necessary UM objects. ***/ try { ctx = new LBMContext(); } catch (LBMException ex) { System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message); System.Environment.Exit(1); } TimerCallback cb = new TimerCallback(); LBMTimer timer = new LBMTimer(ctx, 1000, (LBMTimerCallback)cb.onExpiration, null); while (wait == 1) { try { System.Threading.Thread.Sleep(500); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } } ctx.close(); } /* main */
static void Main(String[] args) { LBMContext ctx = null; /* Context object: container for UM "instance". */ /*** Initialization: create necessary UM objects. ***/ try { ctx = new LBMContext(); } catch(LBMException ex) { System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message); System.Environment.Exit(1); } TimerCallback cb = new TimerCallback(); LBMTimer timer = new LBMTimer(ctx,1000,(LBMTimerCallback)cb.onExpiration,null); while (wait == 1) { try { System.Threading.Thread.Sleep(500); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } } ctx.close(); }
public AppTimer(LBMContext ctx, int delay, Callback cb) { try { this.timer = new LBMTimer(ctx,delay,cb.onExpiration,(Object)this); } catch(LBMException ex) { System.Console.Error.WriteLine("Error initializing LBMTimer: " + ex.Message); System.Environment.Exit(1); } this.state = TimerState.PENDING; }
public AppTimer(LBMContext ctx, int delay, Callback cb) { try { this.timer = new LBMTimer(ctx, delay, cb.onExpiration, (Object)this); } catch (LBMException ex) { System.Console.Error.WriteLine("Error initializing LBMTimer: " + ex.Message); System.Environment.Exit(1); } this.state = TimerState.PENDING; }
static void Main(String[] args) { LBMContext ctx = null; /* Context object: container for UM "instance". */ /*** Initialization: create necessary UM objects. ***/ try { ctx = new LBMContext(); } catch (LBMException ex) { System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message); System.Environment.Exit(1); } Callback cb = new Callback(); AppTimer timer = new AppTimer(ctx, 10000, cb); try { System.Threading.Thread.Sleep(1000); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } if (timer.state == TimerState.PENDING) { CancelCallback ccb = new CancelCallback(); LBMTimer cancelTimer = new LBMTimer(ctx, 0, ccb.onExpiration, (Object)timer); timer.sync.WaitOne(); } ctx.close(); Console.WriteLine("cts is closed, Press any key to exit..."); Console.ReadLine(); } /* main */
static void Main(String[] args) { LBMContext ctx = null; /* Context object: container for UM "instance". */ /*** Initialization: create necessary UM objects. ***/ try { ctx = new LBMContext(); } catch(LBMException ex) { System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message); System.Environment.Exit(1); } Callback cb = new Callback(); AppTimer timer = new AppTimer(ctx,10000,cb); try { System.Threading.Thread.Sleep(1000); } catch (Exception eex) { System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception: " + eex.Message); System.Environment.Exit(1); } if (timer.state == TimerState.PENDING) { CancelCallback ccb = new CancelCallback(); LBMTimer cancelTimer = new LBMTimer(ctx,0,ccb.onExpiration,(Object)timer); timer.sync.WaitOne(); } ctx.close(); }