//create constractor public ThreadWithState(string text, int number, ExampleCallback callbackDelegate) { this._boilerplate = text; this._Value = number; this._Callback = callbackDelegate; }
// The constructor obtains the state information and the // callback delegate. public ThreadWithState(string text, int number, ExampleCallback callbackDelegate) { boilerplate = text; value = number; callback = callbackDelegate; }
public WorkItem(ManualResetEvent sync, Int32 from, Int32 to, RpnCalculator calculator, ExampleCallback callback) { m_Sync = sync; m_From = from; m_To = to; m_Calculator = calculator; m_Callback = callback; }
static void Main(string[] args) { ExampleCallback myCallBack = new ExampleCallback(ResultCallback); cruptum inCrupt = new cruptum(myCallBack); Console.WriteLine("enter pleas text"); inCrupt.text = Console.ReadLine(); Console.WriteLine("enter pleas key"); inCrupt.key = Console.ReadLine(); //inCrupt.text = Crupt(inCrupt); Thread t = new Thread(inCrupt.Crupt); t.Start(); //inCrupt.Crupt(); Console.ReadKey(); }
public ThreadWithState(string text, int numbervalue, ExampleCallback callbackdelegate) { Welcomemsg = text; numbervalue = 100; callbackfn = callbackdelegate; }
static int Main(string[] args) { if (args.Length < 1) { Console.WriteLine("usage subscribe_async.exe mw-id=<middleware ID>"); return(-1); } //o Load the command-line input into a GMSEC Config object // A Config object is basically a key-value pair map which is used to // pass configuration options into objects such as Connections, // ConnectionManagers, Subscribe and Publish function calls, Messages, // etc. Config config = new Config(args); InitializeLogging(config); //o Print the GMSEC API version number using the GMSEC Logging // interface // This is useful for determining which version of the API is // configured within the environment Log.Info(ConnectionManager.GetAPIVersion()); try { //o Create a ConnectionManager object // This is the linchpin for all communications between the // GMSEC API and the middleware server ConnectionManager connMgr = new ConnectionManager(config); //o Open the connection to the middleware Log.Info("Opening the connection to the middleware server"); connMgr.Initialize(); //o Output middleware client library version Log.Info(connMgr.GetLibraryVersion()); //o Set up a subscription to listen for Messages with the topic // "GMSEC.TEST.PUBLISH" which are published to the middleware // bus and register the callback object to the subscription // Subscription subject wildcard syntax: // * - Matches any one token separated by periods in a subject // > - Reading left to right, matches everything up to and ONE // or more tokens in a subject // + - Reading left to right, matches everything up to and ZERO // or more tokens in a subject // For more information on wildcards, please see the GMSEC API // User's Guide Log.Info("Subscribing to the topic: " + DEFAULT_SUBSCRIPTION_SUBJECT); ExampleCallback cb = new ExampleCallback(); connMgr.Subscribe(DEFAULT_SUBSCRIPTION_SUBJECT, cb); //o Start the AutoDispatcher to begin asynchronously processing // messages connMgr.StartAutoDispatch(); //o Because the handling of messages is occurring asynchronously // in another thread, we will need to 'busy wait' here until a // message is received while (cb.ReceivedMessage == false) { Thread.Sleep(100); } //o Clean up connMgr.StopAutoDispatch(); connMgr.Cleanup(); } catch (Exception e) { Log.Error(e.ToString()); return(-1); } return(0); }
static int Main(string[] args) { if (args.Length < 1) { Console.WriteLine("usage reply_async.exe mw-id=<middleware ID>"); return(-1); } //o Load the command-line input into a GMSEC Config object // A Config object is basically a key-value pair map which is used to // pass configuration options into objects such as Connections, // ConnectionManagers, Subscribe and Publish function calls, Messages, // etc. Config config = new Config(args); //o Since this example program uses an invalid message, we ensure the // validation check is disabled. config.AddValue("gmsec-msg-content-validate-all", "false"); // If it was not specified in the command-line arguments, set LOGLEVEL // to 'INFO' and LOGFILE to 'stdout' to allow the program report output // on the terminal/command line InitializeLogging(config); //o Output GMSEC API version Log.Info(ConnectionManager.GetAPIVersion()); try { //o Create the Connection ConnectionManager connMgr = new ConnectionManager(config); //o Connect connMgr.Initialize(); //o Output middleware client library version Log.Info(connMgr.GetLibraryVersion()); //o Subscribe ExampleCallback cb = new ExampleCallback(); connMgr.Subscribe(DEFAULT_REQUEST_SUBJECT, cb); //o Start the AutoDispatcher to begin async message receipt connMgr.StartAutoDispatch(); //o Loop while waiting for the asynchronous response until done while (cb.ReplySent == false) { Thread.Sleep(100); } //o Wait for a few moments to ensure that the asynchronous reply // transaction went through with the middleware before closing // the connection and exiting the process for (int i = 0; i < 5; i++) { Thread.Sleep(100); } //o Clean up connMgr.StopAutoDispatch(); connMgr.Cleanup(); } catch (Exception e) { Log.Error(e.ToString()); return(-1); } return(0); }
public ThreadWithState(string text, int value, ExampleCallback callback) { _text = text; _value = value; _callback = callback; }
public void helloThord(ExampleCallback cb) { ecb = cb; Thread t = new Thread(new ThreadStart(thread_helloThord)); t.Start(); }
public ThreadWithCallBack(string text, int num, ExampleCallback callBackDelegate) { input = text; number = num; callback = callBackDelegate; }
public ThreadWithState(string text, int number, ExampleCallback ec) { boilerplate = text; value = number; callback = ec; }
public cruptum(ExampleCallback callbackDelegate) { callback = callbackDelegate; }
public ThreadWithState(string text, int number, ExampleCallback callback) { m_text = text; m_number = number; m_callback = callback; }