Annotation of q_a/samples/readwrit/readwrit.c, revision 1.1.1.3

1.1       root        1: 
1.1.1.3 ! root        2: /******************************************************************************\
        !             3: *       This is a part of the Microsoft Source Code Samples. 
        !             4: *       Copyright (C) 1993 Microsoft Corporation.
        !             5: *       All rights reserved. 
        !             6: *       This source code is only intended as a supplement to 
        !             7: *       Microsoft Development Tools and/or WinHelp documentation.
        !             8: *       See these sources for detailed information regarding the 
        !             9: *       Microsoft samples programs.
        !            10: \******************************************************************************/
1.1       root       11: 
1.1.1.2   root       12: /****************************************************************************\
                     13: **   MODULE:  Test Engine                                                  **
                     14: **                                                                         **
                     15: **                                                                         **
                     16: **   PURPOSE: This is a simple driver to test my database dll's            **
                     17: **            ability to handle multiple read's and writes without         **
                     18: **            corrupting the database.                                     **
                     19: **                                                                         **
                     20: **                                                                         **
                     21: **                                                                         **
                     22: **                                                                         **
                     23: **   COMMENTS:                                                             **
                     24: **                                                                         **
                     25: **                                                                         **
                     26: **                                                                         **
                     27: \***************************************************************************/
                     28: 
                     29: 
1.1.1.3 ! root       30: 
        !            31: #define STRICT
        !            32: #define NOMINMAX
        !            33: #include <windows.h>
        !            34: #include <stdlib.h>
        !            35: #include <stdio.h>
        !            36: #include <string.h>
        !            37: 
        !            38: #include "DataBase.h"
        !            39: 
        !            40: VOID Read ( PSZ psz ) ;
        !            41: VOID Write ( PSZ psz ) ;
        !            42: 
        !            43: #define MAX 100
        !            44: 
        !            45: 
1.1       root       46: /*
                     47:  * This is a simple driver to test my database dll's ability to handle
                     48:  * multiple read's and writes without corrupting the database.
                     49:  *
                     50:  */
                     51: 
                     52: 
                     53: 
                     54: void main( void )
                     55: {
                     56:     char psz[20], psztmp[10] ;
                     57:     int  i ;
                     58:     DWORD idThread ;
                     59: 
                     60:     printf ( "\nStart of program\n" ) ;
                     61: 
                     62: /*
                     63:  * Create the reader/writers to stress the database
                     64:  *
                     65:  */
                     66: 
                     67:     for ( i=1; i<=MAX; i++ )
                     68:     {
                     69:         strcat (strcpy ( psz,"In Thread #" ),itoa( i,psztmp, 10)) ;
                     70:         CreateThread ( NULL, 0, (LPTHREAD_START_ROUTINE)Write,psz, 0,
                     71:                  &idThread ) ;
                     72: 
                     73:         CreateThread ( NULL, 0, (LPTHREAD_START_ROUTINE)Read, psz, 0,
                     74:                  &idThread ) ;
                     75: 
                     76:         Sleep( 0 ) ;                        // Relinquish timeslice
                     77:         printf ( "psz = %s\n", psz ) ;      // Print result of the test
                     78:     }
                     79: 
                     80:     printf ( "\nEnd of program\n" ) ;
                     81: 
                     82:     exit ( EXIT_SUCCESS ) ;
                     83: }
                     84: 
                     85: 
                     86: VOID Read ( PSZ psz )
                     87: {
                     88:   ReadDataBase ( psz, NULL ) ;
                     89: }
                     90: 
                     91: VOID Write ( PSZ psz )
                     92: {
                     93: 
                     94:   WriteDataBase ( psz, NULL ) ;
                     95: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.