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

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

unix.superglobalmegacorp.com

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