/*************************************************************************** $name: ThrDestr.c $version: 1.0 $date_modified: 082499 $description: Demonstrates creating and freeing contexts--incomplete example. $owner: NKS Product Manager Copyright (c) 1999 Novell, Inc. All Rights Reserved. THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES. USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK. PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET, DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S CUSTOMERS WITH RESPECT TO THIS CODE. ****************************************************************************/ #include <stdio.h> #include <nks/thread.h> void ThreadFunc ( int *arg ) { /* ** myContext execution would begin here if it weren't re-initialized. */ printf("Thread %d running on context :%08x\n", NXThreadGetId(), *(int *) arg); } void ThreadFunc1 ( int *arg ) { /* ** myContext is re-initialized to begin here. */ printf("Thread %d running on context :%08x\n", NXThreadGetId(), *(int *) arg); } void main( void ) { int error; NXContext_t *myContext; myContext = NXContextAlloc(ThreadFunc, &myContext, NX_PRIO_MED, 0, NX_CTX_NORMAL, &error); if (myContext) { // initialize context... NXContextReinit(myContext, ThreadFunc1, &myContext, NX_PRIO_MED, NX_CTX_NORMAL); NXContextFree(myContext); } }