コード例 #1
0
ファイル: repltest.c プロジェクト: mingpen/OpenNT
int _CRTAPI1
main(
    IN int argc,
    IN char *argv[]
    )

/*++

Routine Description:

    This is a temporary main routine for the replicator service.

Arguments:

    None.

Return Value:

    None.

--*/
{
#ifdef REPL_TEST_STANDALONE
    NET_API_STATUS ApiStatus;
    HANDLE StartHandle;
#endif
    DWORD ChildThreadId;
    HANDLE TestHandle;

#if defined(FAKE_PER_PROCESS_RW_CONFIG)

    NetpInitFakeConfigData();

#endif // FAKE_PER_PROCESS_RW_CONFIG

#ifdef REPL_TEST_STANDALONE
    NetpKdPrint(( "Calling NetpInitRpcServer...\n" ));
    ApiStatus = NetpInitRpcServer();
    NetpAssert( ApiStatus == NO_ERROR );
#endif

    NetpKdPrint(( "Starting everyone with stack size of " FORMAT_DWORD
            " bytes.\n", ARBITRARY_STACK_SIZE ));

#ifdef REPL_TEST_STANDALONE
    //
    // Create a thread which will become first thread of repl service.
    //
    StartHandle = CreateThread(
            NULL,
            ARBITRARY_STACK_SIZE,
            (LPTHREAD_START_ROUTINE) StartReplService,
            NULL,                       // no parameter
            0,                          // no creation flags
            & ChildThreadId);
    NetpAssert( StartHandle != (HANDLE) 0 );

    WaitForMasterThreadInit();

    WaitForClientThreadInit();

#endif

    //
    // Create a thread to test the export dir APIs.
    //
    TestHandle = CreateThread(
            NULL,
            ARBITRARY_STACK_SIZE,
            (LPTHREAD_START_ROUTINE) TestExportDirApis,
            NULL,                       // no parameter
            0,                          // no creation flags
            & ChildThreadId);
    NetpAssert( TestHandle != (HANDLE) 0 );

    //
    // Create a thread to test the repl config APIs.
    //
    TestHandle = CreateThread(
            NULL,
            ARBITRARY_STACK_SIZE,
            (LPTHREAD_START_ROUTINE) TestReplApis,
            NULL,                       // no parameter
            0,                          // no creation flags
            & ChildThreadId);
    NetpAssert( TestHandle != (HANDLE) 0 );

    //
    // Create a thread to test the import dir APIs.
    //
    TestHandle = CreateThread(
            NULL,
            ARBITRARY_STACK_SIZE,
            (LPTHREAD_START_ROUTINE) TestImportDirApis,
            NULL,                       // no parameter
            0,                          // no creation flags
            & ChildThreadId);
    NetpAssert( TestHandle != (HANDLE) 0 );

#ifdef REPL_TEST_STANDALONE
    //
    // Wait for the child threads here...
    //
    WaitForever();
#endif

    return (EXIT_SUCCESS);

}  // main()
コード例 #2
0
ファイル: ThreadManager.cpp プロジェクト: jssfy/learngit_tcp
	void WorkerThread::Run() {
		WaitForever();
		mpTask->Run();
	}