Changeset 1161:636acc108cd9


Ignore:
Timestamp:
02/22/09 13:47:43 (3 years ago)
Author:
niam
Branch:
libdodo
Message:

resolved issue #44: pc::sync::protector is a public interface that wraps pc::(process|thread)::section

Location:
trunk
Files:
4 deleted
28 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r1123 r1161  
    1  
    21prefix:=@prefix@ 
    32datarootdir:=@datarootdir@ 
     
    1312 
    1413CPPFLAGS:=-I./include @CPPFLAGS@ 
    15 LDFLAGS:=-L./ @LDFLAGS@  
     14LDFLAGS:=-L./ @LDFLAGS@ 
    1615CFLAGS:=@CFLAGS@ @DEFS@ 
    1716 
     
    8685        graphicsDraw.o \ 
    8786        graphicsColor.o \ 
    88         pcSyncStack.o \ 
     87        pcSyncProtector.o \ 
    8988        pcSyncSection.o \ 
    9089        pcSyncThreadSection.o \ 
     
    9392        pcThreadCollection.o \ 
    9493        pcJobCollection.o \ 
    95         pcSyncThreadStack.o \ 
    96         pcSyncProcessStack.o \ 
    9794        pcSyncThreadDataSingle.o \ 
    9895        pcSyncProcessDataSingle.o \ 
     
    121118        @rm -f $@.so 
    122119        @$(LN_S) @PACKAGE_NAME@.so.@SO_VERSION@ $@.so 
    123          
     120 
    124121        @echo "" 
    125122        @echo "" 
     
    153150        @echo "-- Installing: ${DESTDIR}$(bindir)/dodo-config" 
    154151        @echo ${DESTDIR}$(bindir)/dodo-config >> install_manifest.txt 
    155          
     152 
    156153        @echo "" 
    157154        @echo "" 
     
    162159clean: 
    163160        @rm -rf *.o *.so* *.a* 
    164  
  • trunk/configure.in

    r1140 r1161  
    1  
    21AC_PREREQ(2.60) 
    32 
     
    8281AC_SUBST(DEBUG) 
    8382AC_ARG_ENABLE(debug, 
    84         AS_HELP_STRING([--enable-debug], [enable debug info]),  
     83        AS_HELP_STRING([--enable-debug], [enable debug info]), 
    8584                [DEBUG="$enableval"], [DEBUG="no"]) 
    8685if test "$DEBUG" = "yes" 
    8786then 
    8887        CFLAGS="$CFLAGS -g -DDEBUG" 
    89          
     88 
    9089        RESULT="$RESULT\nDebug\t\t\t\t\t\t\t\tenabled" 
    9190else 
     
    9493 
    9594AC_ARG_ENABLE(profiling, 
    96         AS_HELP_STRING([--enable-profiling], [enable profiling]),  
     95        AS_HELP_STRING([--enable-profiling], [enable profiling]), 
    9796                [PROFILING="$enableval"], [PROFILING="no"]) 
    9897if test "$PROFILING" = "yes" 
    9998then 
    10099        CFLAGS="$CFLAGS -pg" 
    101          
     100 
    102101        RESULT="$RESULT\nProfiling\t\t\t\t\t\t\tenabled" 
    103102else 
     
    106105 
    107106AC_ARG_ENABLE(libwrap, 
    108         AS_HELP_STRING([--disable-libwrap], [disable libwrap support]),  
     107        AS_HELP_STRING([--disable-libwrap], [disable libwrap support]), 
    109108                [LIBWRAP="$enableval"], [LIBWRAP="yes"]) 
    110109if test "$LIBWRAP" = "yes" 
     
    114113        then 
    115114                LDFLAGS="$LDFLAGS -lwrap" 
    116                  
     115 
    117116                RESULT="$RESULT\nlibwrap\t\t\t\t\t\t\t\tenabled" 
    118117        else 
     
    124123 
    125124AC_ARG_ENABLE(deque, 
    126         AS_HELP_STRING([--disable-deque], [use std::vector instead of std::deque]),  
     125        AS_HELP_STRING([--disable-deque], [use std::vector instead of std::deque]), 
    127126                [DEQUE="$enableval"], [DEQUE="yes"]) 
    128127if test "$DEQUE" = "yes" 
    129128then 
    130         echo -n -e "#define USE_DEQUE 1\n\n" >> include/libdodo/directives.runtime.h         
    131          
     129        echo -n -e "#define USE_DEQUE 1\n\n" >> include/libdodo/directives.runtime.h 
     130 
    132131        RESULT="$RESULT\nDeque\t\t\t\t\t\t\t\tenabled" 
    133132else 
     
    136135 
    137136AC_ARG_ENABLE(io-xexec, 
    138         AS_HELP_STRING([--disable-io-xexec], [compile io:: w/o xexec support]),  
     137        AS_HELP_STRING([--disable-io-xexec], [compile io:: w/o xexec support]), 
    139138                [IO_W_XEXEC="$enableval"], [IO_W_XEXEC="yes"]) 
    140139if test "$IO_W_XEXEC" = "no" 
    141140then 
    142         echo -n -e "#define IO_WO_XEXEC 1\n\n" >> include/libdodo/directives.runtime.h         
     141        echo -n -e "#define IO_WO_XEXEC 1\n\n" >> include/libdodo/directives.runtime.h 
    143142        RESULT="$RESULT\nio::stdio xexec support\t\t\t\t\t\tdisabled" 
    144143        RESULT="$RESULT\nio::network::exchange xexec support\t\t\t\tdisabled" 
     
    165164if test "$DATABASE_W_XEXEC" = "no" 
    166165then 
    167         echo -n -e "#define DATABASE_WO_XEXEC 1\n\n" >> include/libdodo/directives.runtime.h         
     166        echo -n -e "#define DATABASE_WO_XEXEC 1\n\n" >> include/libdodo/directives.runtime.h 
    168167fi 
    169168 
     
    188187 
    189188AC_ARG_WITH([sqlite3], 
    190         AS_HELP_STRING([--with-sqlite3@<:@=DIR@:>@], [use sqlite3]),  
     189        AS_HELP_STRING([--with-sqlite3@<:@=DIR@:>@], [use sqlite3]), 
    191190                [MOD_SQLITE3_DIR="$withval"], [MOD_SQLITE3="no"]) 
    192191if test "$MOD_SQLITE3" != "no" -a "$MOD_SQLITE3_DIR" != "no" 
     
    202201        AC_CHECK_HEADER([sqlite3.h], [], AC_MSG_ERROR(sqlite3 header was not found)) 
    203202        echo -n -e "#define SQLITE3_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    204          
     203 
    205204        RESULT="$RESULT\nSQLite\t\t\t\t\t\t\t\tenabled" 
    206205 
     
    216215 
    217216AC_ARG_WITH([openssl], 
    218         AS_HELP_STRING([--with-openssl@<:@=DIR@:>@], [use openssl]),  
     217        AS_HELP_STRING([--with-openssl@<:@=DIR@:>@], [use openssl]), 
    219218                [MOD_OPENSSL_DIR="$withval"], [MOD_OPENSSL="no"]) 
    220219if test "$MOD_OPENSSL" != "no" -a "$MOD_OPENSSL_DIR" != "no" 
     
    257256 
    258257AC_ARG_WITH([bfd], 
    259         AS_HELP_STRING([--with-bfd@<:@=DIR@:>@], [support library name resolution]),  
     258        AS_HELP_STRING([--with-bfd@<:@=DIR@:>@], [support library name resolution]), 
    260259                [MOD_BFD_DIR="$withval"], [MOD_BFD="no"]) 
    261260if test "$MOD_BFD" != "no" -a "$MOD_BFD_DIR" != "no" 
     
    277276 
    278277AC_ARG_WITH([postgresql], 
    279         AS_HELP_STRING([--with-postgresql@<:@=DIR@:>@], [use postgresql]),  
     278        AS_HELP_STRING([--with-postgresql@<:@=DIR@:>@], [use postgresql]), 
    280279                [MOD_POSTGRESQL_DIR="$withval"], [MOD_POSTGRESQL="no"]) 
    281280if test "$MOD_POSTGRESQL" != "no" -a "$MOD_POSTGRESQL_DIR" != "no" 
     
    298297        AC_CHECK_LIB([pq], [PQexecParams], [], AC_MSG_ERROR(postgresql lib was not found)) 
    299298        AC_CHECK_HEADER([libpq-fe.h], [], AC_MSG_ERROR(postgresql header was not found)) 
    300          
     299 
    301300        AC_LANG_PUSH(C++) 
    302         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <libpq-fe.h>]], [[pg_encoding_to_char(0);]]), [],  
     301        AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <libpq-fe.h>]], [[pg_encoding_to_char(0);]]), [], 
    303302                [echo -n -e "#define POSTGRESQL_NO_ENCODINGTOCHAR 1\n\n" >> include/libdodo/directives.runtime.h]) 
    304303        AC_LANG_POP() 
     
    319318 
    320319AC_ARG_WITH([mysql], 
    321         AS_HELP_STRING([--with-mysql@<:@=DIR@:>@], [use mysql]),  
     320        AS_HELP_STRING([--with-mysql@<:@=DIR@:>@], [use mysql]), 
    322321                [MOD_MYSQL_DIR="$withval"], [MOD_MYSQL="no"]) 
    323322if test "$MOD_MYSQL" != "no" -a "$MOD_MYSQL_DIR" != "no" 
     
    341340        AC_CHECK_LIB([mysqlclient], [mysql_init], [], AC_MSG_ERROR(mySQL lib was not found)) 
    342341        AC_CHECK_HEADER([mysql.h], [], AC_MSG_ERROR(mySQL header was not found)) 
    343          
     342 
    344343        AC_LANG_PUSH(C++) 
    345         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <mysql.h>]], [[my_bool rc = 1; mysql_options(0, MYSQL_OPT_RECONNECT, &rc);]]), [],  
     344        AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <mysql.h>]], [[my_bool rc = 1; mysql_options(0, MYSQL_OPT_RECONNECT, &rc);]]), [], 
    346345                [echo -n -e "#define MYSQL_NO_OPT_RECONNECT 1\n\n" >> include/libdodo/directives.runtime.h]) 
    347346        AC_LANG_POP() 
    348          
     347 
    349348        echo -n -e "#define MYSQL_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    350349 
     
    355354                RESULT="$RESULT\ndata::base::mysql xexec support\t\t\t\t\tenabled" 
    356355        fi 
    357          
     356 
    358357        RESULT="$RESULT\nMySQL\t\t\t\t\t\t\t\tenabled" 
    359358else 
     
    362361 
    363362AC_ARG_WITH([fast-cgi], 
    364         AS_HELP_STRING([--with-fast-cgi@<:@=DIR@:>@], [use fast CGI]),  
     363        AS_HELP_STRING([--with-fast-cgi@<:@=DIR@:>@], [use fast CGI]), 
    365364                [MOD_FASTCGI_DIR="$withval"], [MOD_FASTCGI="no"]) 
    366365if test "$MOD_FASTCGI" != "no" -a "$MOD_FASTCGI_DIR" != "no" 
     
    382381                RESULT="$RESULT\ncgi::fast::exchange xexec support\t\t\t\tenabled" 
    383382        fi 
    384          
     383 
    385384        RESULT="$RESULT\nFastCGI\t\t\t\t\t\t\t\tenabled" 
    386385else 
     
    389388 
    390389AC_ARG_WITH([pcre], 
    391         AS_HELP_STRING([--with-pcre@<:@=DIR@:>@], [use pcre]),  
     390        AS_HELP_STRING([--with-pcre@<:@=DIR@:>@], [use pcre]), 
    392391                [MOD_PCRE_DIR="$withval"], [MOD_PCRE="no"]) 
    393392if test "$MOD_PCRE" != "no" -a "$MOD_PCRE_DIR" != "no" 
     
    406405        AC_CHECK_HEADER([pcre.h], [], AC_MSG_ERROR(pcre header was not found)) 
    407406        echo -n -e "#define PCRE_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    408          
     407 
    409408        RESULT="$RESULT\nPCRE\t\t\t\t\t\t\t\tenabled" 
    410409else 
     
    414413 
    415414AC_ARG_ENABLE(dl, 
    416         AS_HELP_STRING([--enable-dl], [enable dynamic loading]),  
     415        AS_HELP_STRING([--enable-dl], [enable dynamic loading]), 
    417416                [DL="$enableval"], [DL="no"]) 
    418417if test "$DL" = "yes" 
    419418then 
    420419        echo -n -e "#define DL_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    421          
     420 
    422421        AC_ARG_ENABLE(fast-dynamic-loading, 
    423                 AS_HELP_STRING([--disable-fast-dynamic-loading], [do not unload library to produce better performance]),  
     422                AS_HELP_STRING([--disable-fast-dynamic-loading], [do not unload library to produce better performance]), 
    424423                        [DL_FAST="$enableval"], [DL_FAST="yes"]) 
    425424 
    426425        if test "$DL_FAST" = "yes" -a "$OS" = "Linux" 
    427426        then 
    428                 echo -n -e "#define DL_FAST 1\n\n" >> include/libdodo/directives.runtime.h         
     427                echo -n -e "#define DL_FAST 1\n\n" >> include/libdodo/directives.runtime.h 
    429428 
    430429                RESULT="$RESULT\nFast dynamic loading\t\t\t\t\t\tenabled" 
     
    439438 
    440439AC_ARG_WITH([libxml2], 
    441         AS_HELP_STRING([--with-libxml2@<:@=DIR@:>@], [use libxml2]),  
     440        AS_HELP_STRING([--with-libxml2@<:@=DIR@:>@], [use libxml2]), 
    442441                [MOD_LIBXML2_DIR="$withval"], [MOD_LIBXML2="no"]) 
    443442if test "$MOD_LIBXML2" != "no" -a "$MOD_LIBXML2_DIR" != "no" 
     
    462461        AC_CHECK_HEADER([libxml/xmlmemory.h], [], AC_MSG_ERROR(libxml2 header was not found)) 
    463462        echo -n -e "#define LIBXML2_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    464          
     463 
    465464        RESULT="$RESULT\nlibxml2\t\t\t\t\t\t\t\tenabled" 
    466465else 
     
    469468 
    470469AC_ARG_WITH([threading-lib], 
    471         AS_HELP_STRING([--with-threading-lib@<:@=lib@:>@], [specify threading library(supported: pthread), pthread by default]),  
     470        AS_HELP_STRING([--with-threading-lib@<:@=lib@:>@], [specify threading library(supported: pthread), pthread by default]), 
    472471                [MOD_THREAD="$withval"], [MOD_THREAD="pthread"]) 
    473472case "$MOD_THREAD" in 
    474473        pthread) 
    475474                AC_ARG_WITH([pthread-lib], 
    476                         AS_HELP_STRING([--with-pthread-lib@<:@=lib@:>@], [use pthread library(supported: pthread, thr, lthread, c_r), pthread by default]),  
     475                        AS_HELP_STRING([--with-pthread-lib@<:@=lib@:>@], [use pthread library(supported: pthread, thr, lthread, c_r), pthread by default]), 
    477476                                [MOD_PTHREAD_LIB="$withval"], [MOD_PTHREAD_LIB="pthread"]) 
    478477                AC_ARG_WITH([pthread-path], 
    479                         AS_HELP_STRING([--with-pthread-path@<:@=DIR@:>@], [path to pthread installation]),  
     478                        AS_HELP_STRING([--with-pthread-path@<:@=DIR@:>@], [path to pthread installation]), 
    480479                                [MOD_PTHREAD_DIR="$withval"], [MOD_PTHREAD_DIR="/usr"]) 
    481480                CPPFLAGS="$CPPFLAGS -I$MOD_PTHREAD_DIR/include" 
     
    492491 
    493492AC_ARG_WITH([bzip2], 
    494         AS_HELP_STRING([--with-bzip2@<:@=DIR@:>@], [use bzip2]),  
     493        AS_HELP_STRING([--with-bzip2@<:@=DIR@:>@], [use bzip2]), 
    495494                [MOD_BZIP2_DIR="$withval"], [MOD_BZIP2="no"]) 
    496495if test "$MOD_BZIP2" != "no" -a "$MOD_BZIP2_DIR" != "no" 
     
    505504        AC_CHECK_HEADER([bzlib.h], [], AC_MSG_ERROR(bz2 header was not found)) 
    506505        echo -n -e "#define BZIP2_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    507          
     506 
    508507        RESULT="$RESULT\nBZIP2\t\t\t\t\t\t\t\tenabled" 
    509508else 
     
    512511 
    513512AC_ARG_WITH([zlib], 
    514         AS_HELP_STRING([--with-zlib@<:@=DIR@:>@], [use zlib]),  
     513        AS_HELP_STRING([--with-zlib@<:@=DIR@:>@], [use zlib]), 
    515514                [MOD_ZLIB_DIR="$withval"], [MOD_ZLIB="no"]) 
    516515if test "$MOD_ZLIB" != "no" -a "$MOD_ZLIB_DIR" != "no" 
     
    524523        AC_CHECK_HEADER([zlib.h]) 
    525524        AC_ARG_ENABLE([zlib-lib], 
    526                 AS_HELP_STRING([--enable-zlib-lib], [enable zlib as lib]),  
     525                AS_HELP_STRING([--enable-zlib-lib], [enable zlib as lib]), 
    527526                        [MOD_ZLIB_LIB="yes"], [MOD_ZLIB_LIB="no"]) 
    528527        if test "$MOD_ZLIB_LIB" = "yes" 
     
    532531        fi 
    533532        echo -n -e "#define ZLIB_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    534          
     533 
    535534        RESULT="$RESULT\nZLIB\t\t\t\t\t\t\t\tenabled" 
    536535else 
     
    539538 
    540539AC_ARG_WITH([iconv], 
    541         AS_HELP_STRING([--with-iconv@<:@=DIR@:>@], [use iconv]),  
     540        AS_HELP_STRING([--with-iconv@<:@=DIR@:>@], [use iconv]), 
    542541                [MOD_ICONV_DIR="$withval"], [MOD_ICONV="no"]) 
    543542if test "$MOD_ICONV" != "no" -a "$MOD_ICONV_DIR" != "no" 
     
    551550        AC_CHECK_HEADER([iconv.h]) 
    552551        AC_ARG_ENABLE([iconv-lib], 
    553                 AS_HELP_STRING([--enable-iconv-lib], [enable iconv as lib]),  
     552                AS_HELP_STRING([--enable-iconv-lib], [enable iconv as lib]), 
    554553                        [MOD_ICONV_LIB="yes"], [MOD_ICONV_LIB="no"]) 
    555554                if test "$MOD_ICONV_LIB" = "yes" 
     
    559558        fi 
    560559        echo -n -e "#define ICONV_EXT 1\n\n" >> include/libdodo/directives.runtime.h 
    561          
     560 
    562561        RESULT="$RESULT\niconv\t\t\t\t\t\t\t\tenabled" 
    563562else 
     
    566565 
    567566AC_ARG_WITH([imagemagick], 
    568         AS_HELP_STRING([--with-imagemagick@<:@=DIR@:>@], [use ImageMagick]),  
     567        AS_HELP_STRING([--with-imagemagick@<:@=DIR@:>@], [use ImageMagick]), 
    569568                [MOD_IMAGEMAGICK_DIR="$withval"], [MOD_IMAGEMAGICK="no"]) 
    570569if test "$MOD_IMAGEMAGICK" != "no" -a "$MOD_IMAGEMAGICK_DIR" != "no" 
     
    601600        else 
    602601                LDFLAGS="$LDFLAGS -lMagickCore" 
    603                  
     602 
    604603        fi 
    605604        if test "$VERY_OLD_IMAGEMAGICK_LIB" != "yes" 
     
    612611 
    613612        AC_ARG_ENABLE(graphics-xexec, 
    614                 AS_HELP_STRING([--disable-graphics-xexec], [compile graphics w/o xexec support]),  
     613                AS_HELP_STRING([--disable-graphics-xexec], [compile graphics w/o xexec support]), 
    615614                        [GRAPHICS_W_XEXEC="$enableval"], [GRAPHICS_W_XEXEC="yes"]) 
    616615        if test "$GRAPHICS_W_XEXEC" = "no" 
    617616        then 
    618                 echo -n -e "#define GRAPHICS_WO_XEXEC 1\n\n" >> include/libdodo/directives.runtime.h         
    619                  
     617                echo -n -e "#define GRAPHICS_WO_XEXEC 1\n\n" >> include/libdodo/directives.runtime.h 
     618 
    620619                RESULT="$RESULT\ngraphics xexec support\t\t\t\t\t\tdisabled" 
    621620        else 
    622621                RESULT="$RESULT\ngraphics xexec support\t\t\t\t\t\tenabled" 
    623622        fi 
    624          
     623 
    625624        RESULT="$RESULT\nImageMagick\t\t\t\t\t\t\tenabled" 
    626625else 
     
    736735        AC_LANG_POP() 
    737736 
    738         echo -n -e "#define CALLSTACK_EX 1\n\n" >> include/libdodo/directives.runtime.h         
     737        echo -n -e "#define CALLSTACK_EX 1\n\n" >> include/libdodo/directives.runtime.h 
    739738fi 
    740739 
     
    743742        AC_CHECK_HEADER([dlfcn.h], [], [AC_MSG_ERROR(dlfcn.h header was not found)]) 
    744743        AC_ARG_ENABLE([dl-lib], 
    745                 AS_HELP_STRING([--disable-dl-lib], [disable dl as lib]),  
     744                AS_HELP_STRING([--disable-dl-lib], [disable dl as lib]), 
    746745                        [MOD_DL_LIB="$enableval"], [MOD_DL_LIB="yes"]) 
    747746        if test "$MOD_DL_LIB" = "yes" 
     
    752751fi 
    753752 
    754 echo -n -e "#endif\n" >> include/libdodo/directives.runtime.h         
     753echo -n -e "#endif\n" >> include/libdodo/directives.runtime.h 
    755754 
    756755## 
  • trunk/include/libdodo/cgiFastExchange.h

    r1160 r1161  
    4141#include <libdodo/cgiExchange.h> 
    4242#include <libdodo/ioChannel.h> 
    43 #include <libdodo/pcSyncThreadStack.h> 
    4443 
    4544namespace dodo 
  • trunk/include/libdodo/cgiFastServer.h

    r1160 r1161  
    4848#include <libdodo/cgiFastExchange.h> 
    4949#include <libdodo/ioChannel.h> 
    50 #include <libdodo/pcSyncThreadStack.h> 
    5150 
    5251namespace dodo 
  • trunk/include/libdodo/ioChannel.h

    r1160 r1161  
    3636#include <libdodo/types.h> 
    3737#include <libdodo/ioEventInfo.h> 
    38 #include <libdodo/pcSyncThreadStack.h> 
     38#include <libdodo/pcSyncProcessSection.h> 
     39#include <libdodo/pcSyncProtector.h> 
    3940 
    4041namespace dodo 
     
    8384                 * @brief implements an interface for I/O operations 
    8485                 */ 
    85                 class channel : virtual public eventInfo, 
    86                                                 virtual public pc::sync::thread::stack 
     86                class channel : virtual public eventInfo 
    8787#ifndef IO_WO_XEXEC 
    8888                                                , 
     
    169169 
    170170#endif 
     171                        pc::sync::section *keeper;                                                       ///< section locker 
    171172                }; 
    172173        }; 
  • trunk/include/libdodo/ioEvent.h

    r1160 r1161  
    4040#include <libdodo/toolsMisc.h> 
    4141#include <libdodo/ioEventInfo.h> 
    42 #include <libdodo/pcSyncThreadStack.h> 
     42#include <libdodo/pcSyncProcessSection.h> 
     43#include <libdodo/pcSyncProtector.h> 
    4344 
    4445namespace dodo 
     
    6263                 * @brief provides information if in/output stream is readable/writable 
    6364                 */ 
    64                 class event : virtual public pc::sync::thread::stack 
     65                class event 
    6566                { 
    6667                  private: 
     
    137138 
    138139                        int descs;                                  ///< descriptors counter 
     140 
     141                        pc::sync::section *keeper;                                      ///< section locker 
    139142                }; 
    140143        }; 
  • trunk/include/libdodo/ioNetworkExchange.h

    r1160 r1161  
    4949#include <libdodo/types.h> 
    5050#include <libdodo/xexec.h> 
    51 #include <libdodo/pcSyncThreadStack.h> 
    5251 
    5352namespace dodo 
  • trunk/include/libdodo/ioNetworkSslExchange.h

    r1160 r1161  
    5353#include <libdodo/types.h> 
    5454#include <libdodo/xexec.h> 
    55 #include <libdodo/pcSyncThreadStack.h> 
    5655 
    5756namespace dodo 
  • trunk/include/libdodo/ioPipe.h

    r1160 r1161  
    4545#include <libdodo/ioChannel.h> 
    4646#include <libdodo/ioNetwork.h> 
    47 #include <libdodo/pcSyncThreadStack.h> 
    4847 
    4948namespace dodo 
  • trunk/include/libdodo/ioStdio.h

    r1160 r1161  
    4242#include <libdodo/types.h> 
    4343#include <libdodo/ioPipe.h> 
    44 #include <libdodo/pcSyncThreadStack.h> 
    4544 
    4645namespace dodo 
  • trunk/include/libdodo/pcSyncDataCollection.h

    r1160 r1161  
    3434 
    3535#include <libdodo/types.h> 
    36 #include <libdodo/pcSyncStack.h> 
    3736 
    3837namespace dodo 
  • trunk/include/libdodo/pcSyncProcessDataCollection.h

    r1160 r1161  
    3636#include <libdodo/pcSyncDataCollection.h> 
    3737#include <libdodo/pcSyncProcessDataCollectionEx.h> 
    38 #include <libdodo/pcSyncProcessStack.h> 
     38#include <libdodo/pcSyncProcessSection.h> 
     39#include <libdodo/pcSyncProtector.h> 
    3940 
    4041namespace dodo 
     
    5253                                         * @brief implements collection of shared data for processes 
    5354                                         */ 
    54                                         class collection : public sync::data::collection, 
    55                                                                            virtual public sync::process::stack 
     55                                        class collection : public sync::data::collection 
    5656                                        { 
    5757                                          private: 
     
    123123 
    124124                                                dodoList<pc::sync::data::__info>::iterator current; ///< iterator for list of shared data[for matched with getShare method] 
     125 
     126                                                section *keeper;                                                                        ///< section locker 
    125127                                        }; 
    126128                                }; 
  • trunk/include/libdodo/pcSyncProtector.h

    r1160 r1161  
    11/*************************************************************************** 
    2  *            pcSyncStack.h 
     2 *            pcSyncProtector.h 
    33 * 
    44 *  Sat Oct 20 02:00:55 2007 
     
    2828 */ 
    2929 
    30 #ifndef _PCSYNCSTACK_H_ 
    31 #define _PCSYNCSTACK_H_ 1 
     30#ifndef _PCSYNCPROTECTOR_H_ 
     31#define _PCSYNCPROTECTOR_H_ 1 
    3232 
    3333#include <libdodo/directives.h> 
     
    4444                { 
    4545                        /** 
    46                          * @class stack 
    47                          * @brief provides mutex lock and guard class 
     46                         * @class protector 
     47                         * @brief provides thread/process safe behaviour 
     48                         * @note it locks in constructor and unlocks in destructor 
    4849                         */ 
    49                         class stack 
     50                        class protector 
    5051                        { 
    51                           protected: 
     52                          public: 
    5253 
    53                                 section *keeper; ///< lock 
     54                                /** 
     55                                 * contructor 
     56                                 */ 
     57                                protector(section *parent); 
    5458 
    5559                                /** 
    5660                                 * destructor 
    5761                                 */ 
    58                                 virtual ~stack() = 0; 
     62                                virtual ~protector(); 
    5963 
    60                                 /** 
    61                                  * @class protector 
    62                                  * @brief provides thread safe behaviour 
    63                                  * @note it locks in constructor and unlocks in destructor 
    64                                  */ 
    65                                 class protector 
    66                                 { 
    67                                   public: 
     64                          protected: 
    6865 
    69                                         /** 
    70                                          * contructor 
    71                                          */ 
    72                                         protector(const stack *parent); 
    73  
    74                                         /** 
    75                                          * destructor 
    76                                          */ 
    77                                         virtual ~protector(); 
    78  
    79                                   protected: 
    80  
    81                                         const stack *parent; ///< lock 
    82                                 }; 
     66                                section *keeper; ///< lock 
    8367                        }; 
    8468                }; 
  • trunk/include/libdodo/pcSyncThreadDataCollection.h

    r1160 r1161  
    3636#include <libdodo/pcSyncDataCollection.h> 
    3737#include <libdodo/pcSyncThreadDataCollectionEx.h> 
    38 #include <libdodo/pcSyncThreadStack.h> 
     38#include <libdodo/pcSyncProtector.h> 
     39#include <libdodo/pcSyncThreadSection.h> 
    3940 
    4041namespace dodo 
     
    5253                                         * @brief implements collection of shared data for threads 
    5354                                         */ 
    54                                         class collection : public sync::data::collection, 
    55                                                                            virtual public sync::thread::stack 
     55                                        class collection : public sync::data::collection 
    5656                                        { 
    5757                                          private: 
     
    123123 
    124124                                                dodoList<pc::sync::data::__info>::iterator current; ///< iterator for list of shared data[for matched with getShare method] 
     125 
     126                                                section *keeper;                                                                        ///< section locker 
    125127                                        }; 
    126128                                }; 
  • trunk/include/libdodo/toolsCode.h

    r1160 r1161  
    5858 
    5959#include <libdodo/types.h> 
    60 #include <libdodo/ioNetwork.h> 
    61 #include <libdodo/toolsNetwork.h> 
    6260#include <libdodo/toolsString.h> 
    6361#include <libdodo/toolsCodeEx.h> 
  • trunk/include/libdodo/toolsLogger.h

    r1160 r1161  
    3535#include <libdodo/ioChannel.h> 
    3636#include <libdodo/toolsTime.h> 
    37 #include <libdodo/pcSyncThreadStack.h> 
     37#include <libdodo/pcSyncProcessSection.h> 
     38#include <libdodo/pcSyncProtector.h> 
    3839#include <libdodo/types.h> 
    3940 
     
    7778                 * @brief provides logging function 
    7879                 */ 
    79                 class logger : virtual public pc::sync::thread::stack, 
    80                                            public singleton<logger> 
     80                class logger : public singleton<logger> 
    8181                { 
    8282                  public: 
     
    135135                        static const dodoString levels[LOGGER_LEVELS];  ///< log levels statements 
    136136                        static const int syslogLevels[LOGGER_LEVELS];   ///< syslog log levels 
     137 
     138                        pc::sync::section *keeper;                                              ///< section locker 
    137139                }; 
    138140        }; 
  • trunk/src/ioChannel.cc

    r1160 r1161  
    4444 
    4545channel::channel() : inSize(IO_INSIZE), 
    46                                          outSize(IO_OUTSIZE) 
     46                                         outSize(IO_OUTSIZE), 
     47                                         keeper(new pc::sync::process::section) 
    4748 
    4849#ifndef IO_WO_XEXEC 
     
    5960channel::~channel() 
    6061{ 
     62        delete keeper; 
    6163} 
    6264 
     
    6567dodoString channel::read() 
    6668{ 
    67         protector pg(this); 
     69        pc::sync::protector pg(keeper); 
    6870 
    6971        dodoString a_str; 
     
    125127dodoString channel::readStream() 
    126128{ 
    127         protector pg(this); 
     129        pc::sync::protector pg(keeper); 
    128130 
    129131        dodoString a_str; 
     
    191193void channel::write(const dodoString &a_data) 
    192194{ 
    193         protector pg(this); 
     195        pc::sync::protector pg(keeper); 
    194196 
    195197#ifndef IO_WO_XEXEC 
     
    228230void channel::writeStream(const dodoString &a_data) 
    229231{ 
    230         protector pg(this); 
     232        pc::sync::protector pg(keeper); 
    231233 
    232234#ifndef IO_WO_XEXEC 
  • trunk/src/ioEvent.cc

    r1160 r1161  
    4040//------------------------------------------------------------------- 
    4141 
    42 event::event() : descs(0) 
     42event::event() : descs(0), 
     43                                 keeper(new pc::sync::process::section) 
    4344{ 
    4445} 
     
    4849event::~event() 
    4950{ 
     51        delete keeper; 
    5052} 
    5153 
     
    5456int event::addChannel(const eventInfo &fl) 
    5557{ 
    56         protector pg(this); 
     58pc::sync::protector pg(keeper); 
    5759 
    5860        __eventInOutDescriptors tempD; 
     
    7274                                                                 int                  timeout) const 
    7375{ 
    74         protector pg(this); 
     76pc::sync::protector pg(keeper); 
    7577 
    7678        int count = -1; 
     
    157159                                                                 int                  timeout) const 
    158160{ 
    159         protector pg(this); 
     161pc::sync::protector pg(keeper); 
    160162 
    161163        int count = -1; 
     
    242244                                           int timeout) const 
    243245{ 
    244         protector pg(this); 
     246pc::sync::protector pg(keeper); 
    245247 
    246248        pollfd fd; 
     
    288290void event::delChannel(int pos) 
    289291{ 
    290         protector pg(this); 
     292pc::sync::protector pg(keeper); 
    291293 
    292294        dodoArray<__eventInOutDescriptors>::iterator i(desc.begin()), j(desc.end()); 
     
    307309                                           int timeout) const 
    308310{ 
    309         protector pg(this); 
     311pc::sync::protector pg(keeper); 
    310312 
    311313        pollfd fd; 
  • trunk/src/ioFileFifo.cc

    r1160 r1161  
    204204int fifo::getInDescriptor() const 
    205205{ 
    206         protector pg(this); 
     206pc::sync::protector pg(keeper); 
    207207 
    208208        if (handler == NULL) 
     
    218218int fifo::getOutDescriptor() const 
    219219{ 
    220         protector pg(this); 
     220pc::sync::protector pg(keeper); 
    221221 
    222222        if (handler == NULL) 
     
    232232void fifo::clone(const fifo &fd) 
    233233{ 
    234         protector pg(this); 
     234pc::sync::protector pg(keeper); 
    235235 
    236236        if (handler != NULL) 
     
    293293void fifo::close() 
    294294{ 
    295         protector pg(this); 
     295pc::sync::protector pg(keeper); 
    296296 
    297297#ifndef IO_WO_XEXEC 
     
    320320                                short            a_mode) 
    321321{ 
    322         protector pg(this); 
     322pc::sync::protector pg(keeper); 
    323323 
    324324#ifndef IO_WO_XEXEC 
     
    426426bool fifo::isBlocked() 
    427427{ 
    428         protector pg(this); 
     428pc::sync::protector pg(keeper); 
    429429 
    430430        return blocked; 
     
    435435void fifo::block(bool flag) 
    436436{ 
    437         protector pg(this); 
     437pc::sync::protector pg(keeper); 
    438438 
    439439        if (handler == NULL) 
     
    650650void fifo::flush() 
    651651{ 
    652         protector pg(this); 
     652pc::sync::protector pg(keeper); 
    653653 
    654654        if (handler == NULL) 
  • trunk/src/ioFileRegular.cc

    r1160 r1161  
    209209int regular::getInDescriptor() const 
    210210{ 
    211         protector pg(this); 
     211pc::sync::protector pg(keeper); 
    212212 
    213213        if (handler == NULL) 
     
    223223int regular::getOutDescriptor() const 
    224224{ 
    225         protector pg(this); 
     225pc::sync::protector pg(keeper); 
    226226 
    227227        if (handler == NULL) 
     
    237237void regular::clone(const regular &fd) 
    238238{ 
    239         protector pg(this); 
     239pc::sync::protector pg(keeper); 
    240240 
    241241        if (handler != NULL) 
     
    306306void regular::close() 
    307307{ 
    308         protector pg(this); 
     308pc::sync::protector pg(keeper); 
    309309 
    310310#ifndef IO_WO_XEXEC 
     
    333333                                   short            a_mode) 
    334334{ 
    335         protector pg(this); 
     335pc::sync::protector pg(keeper); 
    336336 
    337337#ifndef IO_WO_XEXEC 
     
    543543void regular::erase() 
    544544{ 
    545         protector pg(this); 
     545pc::sync::protector pg(keeper); 
    546546 
    547547        char *empty = new char[outSize]; 
     
    574574void regular::flush() 
    575575{ 
    576         protector pg(this); 
     576pc::sync::protector pg(keeper); 
    577577 
    578578        if (handler == NULL) 
  • trunk/src/ioFileTemp.cc

    r1160 r1161  
    111111int temp::getInDescriptor() const 
    112112{ 
    113         protector pg(this); 
     113pc::sync::protector pg(keeper); 
    114114 
    115115        if (handler == NULL) 
     
    125125int temp::getOutDescriptor() const 
    126126{ 
    127         protector pg(this); 
     127pc::sync::protector pg(keeper); 
    128128 
    129129        if (handler == NULL) 
     
    139139void temp::clone(const temp &fd) 
    140140{ 
    141         protector pg(this); 
     141pc::sync::protector pg(keeper); 
    142142 
    143143        if (handler != NULL) 
     
    187187void temp::close() 
    188188{ 
    189         protector pg(this); 
     189pc::sync::protector pg(keeper); 
    190190 
    191191#ifndef IO_WO_XEXEC 
     
    213213void temp::open() 
    214214{ 
    215         protector pg(this); 
     215pc::sync::protector pg(keeper); 
    216216 
    217217#ifndef IO_WO_XEXEC 
     
    355355void temp::erase() 
    356356{ 
    357         protector pg(this); 
     357pc::sync::protector pg(keeper); 
    358358 
    359359        char *empty = new char[outSize]; 
     
    386386void temp::flush() 
    387387{ 
    388         protector pg(this); 
     388pc::sync::protector pg(keeper); 
    389389 
    390390        if (handler == NULL) 
  • trunk/src/ioNetworkExchange.cc

    r1160 r1161  
    117117void exchange::close() 
    118118{ 
    119         protector pg(this); 
     119pc::sync::protector pg(keeper); 
    120120 
    121121#ifndef IO_WO_XEXEC 
     
    142142                                        bool blockInherited) 
    143143{ 
    144         protector pg(this); 
     144pc::sync::protector pg(keeper); 
    145145 
    146146        if (socket != -1) 
     
    183183bool exchange::isAlive() 
    184184{ 
    185         protector pg(this); 
     185pc::sync::protector pg(keeper); 
    186186 
    187187        if (socket == -1) 
     
    449449int exchange::getInDescriptor() const 
    450450{ 
    451         protector pg(this); 
     451pc::sync::protector pg(keeper); 
    452452 
    453453        return socket; 
     
    458458int exchange::getOutDescriptor() const 
    459459{ 
    460         protector pg(this); 
     460pc::sync::protector pg(keeper); 
    461461 
    462462        return socket; 
  • trunk/src/ioNetworkSslExchange.cc

    r1160 r1161  
    140140void exchange::close() 
    141141{ 
    142         protector pg(this); 
     142pc::sync::protector pg(keeper); 
    143143 
    144144#ifndef IO_WO_XEXEC 
     
    167167                                        bool blockInherited) 
    168168{ 
    169         protector pg(this); 
     169pc::sync::protector pg(keeper); 
    170170 
    171171        if (socket != -1) 
     
    210210bool exchange::isAlive() 
    211211{ 
    212         protector pg(this); 
     212pc::sync::protector pg(keeper); 
    213213 
    214214        if (socket == -1) 
  • trunk/src/ioPipe.cc

    r1160 r1161  
    145145void io::pipe::clone(const pipe &fd) 
    146146{ 
    147         protector pg(this); 
     147pc::sync::protector pg(keeper); 
    148148 
    149149        if (inHandle != NULL) 
     
    219219int io::pipe::getInDescriptor() const 
    220220{ 
    221         protector pg(this); 
     221pc::sync::protector pg(keeper); 
    222222 
    223223        if (inHandle == NULL) 
     
    233233int io::pipe::getOutDescriptor() const 
    234234{ 
    235         protector pg(this); 
     235pc::sync::protector pg(keeper); 
    236236 
    237237        if (outHandle == NULL) 
     
    247247void io::pipe::close() 
    248248{ 
    249         protector pg(this); 
     249pc::sync::protector pg(keeper); 
    250250 
    251251#ifndef IO_WO_XEXEC 
     
    283283void io::pipe::open() 
    284284{ 
    285         protector pg(this); 
     285pc::sync::protector pg(keeper); 
    286286 
    287287#ifndef IO_WO_XEXEC 
     
    506506void io::pipe::flush() 
    507507{ 
    508         protector pg(this); 
     508pc::sync::protector pg(keeper); 
    509509 
    510510        if (outHandle == NULL) 
     
    523523io::network::__peerInfo io::pipe::peerInfo() 
    524524{ 
    525         protector pg(this); 
     525pc::sync::protector pg(keeper); 
    526526 
    527527        if (inHandle == NULL) 
     
    596596bool io::pipe::isBlocked() 
    597597{ 
    598         protector pg(this); 
     598pc::sync::protector pg(keeper); 
    599599 
    600600        return blocked; 
     
    605605void io::pipe::block(bool flag) 
    606606{ 
    607         protector pg(this); 
     607pc::sync::protector pg(keeper); 
    608608 
    609609        if (inHandle == NULL && outHandle == NULL) 
  • trunk/src/ioString.cc

    r1160 r1161  
    122122void string::clone(const string &fd) 
    123123{ 
    124         protector pg(this); 
     124pc::sync::protector pg(keeper); 
    125125 
    126126        pos = fd.pos; 
     
    175175void string::erase() 
    176176{ 
    177         protector pg(this); 
     177pc::sync::protector pg(keeper); 
    178178 
    179179        unsigned long pos = blockOffset ? this->pos * outSize : this->pos; 
  • trunk/src/pcSyncProcessDataCollection.cc

    r1160 r1161  
    3939//------------------------------------------------------------------- 
    4040 
    41 collection::collection() : shareNum(0) 
     41collection::collection() : shareNum(0), 
     42                                                   keeper(new section(0)) 
    4243{ 
    4344} 
     
    4748collection::~collection() 
    4849{ 
     50        delete keeper; 
    4951} 
    5052 
     
    5355unsigned long collection::add(void *data) 
    5456{ 
    55         protector tg(this); 
     57pc::sync::protector pg(keeper); 
    5658 
    5759        pc::sync::data::__info share; 
     
    6971void collection::del(unsigned long position) 
    7072{ 
    71         protector tg(this); 
     73pc::sync::protector pg(keeper); 
    7274 
    7375        if (getShare(position)) 
     
    8688                                         void          *data) 
    8789{ 
    88         protector tg(this); 
     90pc::sync::protector pg(keeper); 
    8991 
    9092        if (getShare(position)) 
     
    102104const void *collection::get(unsigned long position) 
    103105{ 
    104         protector tg(this); 
     106pc::sync::protector pg(keeper); 
    105107 
    106108        if (getShare(position)) 
  • trunk/src/pcSyncProtector.cc

    r1111 r1161  
    11/*************************************************************************** 
    2  *            pcSyncStack.cc 
     2 *            pcSyncProtector.cc 
    33 * 
    44 *  Sat Oct 20 11:00:55 2007 
     
    2828 */ 
    2929 
    30 #include <libdodo/pcSyncStack.h> 
     30#include <libdodo/pcSyncProtector.h> 
    3131 
    3232using namespace dodo::pc::sync; 
    3333 
    34 stack::~stack() 
     34protector::protector(section *a_keeper) : keeper(a_keeper) 
    3535{ 
     36        keeper->acquire(); 
    3637} 
    3738 
    3839//------------------------------------------------------------------- 
    3940 
    40 stack::protector::protector(const stack *a_parent) : parent(a_parent) 
    41 { 
    42         parent->keeper->acquire(); 
    43 } 
    44  
    45 //------------------------------------------------------------------- 
    46  
    47 stack::protector::~protector() 
     41protector::~protector() 
    4842{ 
    4943        try 
    5044        { 
    51                 parent->keeper->release(); 
     45                keeper->release(); 
    5246        } 
    5347        catch (exception::basic &ex) 
  • trunk/src/pcSyncThreadDataCollection.cc

    r1160 r1161  
    3939//------------------------------------------------------------------- 
    4040 
    41 collection::collection() : shareNum(0) 
     41collection::collection() : shareNum(0), 
     42                                                   keeper(new section) 
    4243{ 
    4344} 
     
    4748collection::~collection() 
    4849{ 
     50        delete keeper; 
    4951} 
    5052 
     
    5355unsigned long collection::add(void *data) 
    5456{ 
    55         protector tg(this); 
     57pc::sync::protector tg(keeper); 
    5658 
    5759        pc::sync::data::__info share; 
     
    6971void collection::del(unsigned long position) 
    7072{ 
    71         protector tg(this); 
     73pc::sync::protector tg(keeper); 
    7274 
    7375        if (getShare(position)) 
     
    8688                                         void          *data) 
    8789{ 
    88         protector tg(this); 
     90pc::sync::protector tg(keeper); 
    8991 
    9092        if (getShare(position)) 
     
    102104const void *collection::get(unsigned long position) 
    103105{ 
    104         protector tg(this); 
     106pc::sync::protector tg(keeper); 
    105107 
    106108        if (getShare(position)) 
  • trunk/src/toolsLogger.cc

    r1160 r1161  
    6464logger::logger() : handlersNum(0), 
    6565                                   timeFormat(" %d/%m/%Y.%H-%M-%S: "), 
    66                                    forward(false) 
     66                                   forward(false), 
     67                                   keeper(new pc::sync::process::section) 
    6768{ 
    6869} 
     
    7273logger::~logger() 
    7374{ 
     75        delete keeper; 
    7476} 
    7577 
     
    7981                                                  io::channel *handler) 
    8082{ 
    81         protector tg(this); 
     83        pc::sync::protector pg(keeper); 
    8284 
    8385        __logMap lm; 
     
    9698void logger::remove(unsigned long position) 
    9799{ 
    98         protector tg(this); 
     100        pc::sync::protector pg(keeper); 
    99101 
    100102        dodoList<__logMap>::iterator i(handlers.begin()), j(handlers.end()); 
     
    115117                                 const dodoString &msg) 
    116118{ 
    117         protector tg(this); 
     119        pc::sync::protector pg(keeper); 
    118120 
    119121        if (level < 0 && level >= LOGGER_LEVELS) 
  • trunk/tests/pcprocesscollection_test/test.cc

    r1142 r1161  
    1313#include <libdodo/pcSyncProcessDataSingle.h> 
    1414#include <libdodo/pcSyncProcessDataCollection.h> 
     15#include <libdodo/pcSyncProtector.h> 
    1516 
    1617#include <iostream> 
     
    4748                cout << "Data: " << dt << endl, cout.flush(); 
    4849                shD.close(); 
    49                  
     50 
    5051                cout << (char *)dgC.get(dgCI), cout.flush(); 
    51                  
     52 
    5253                cout << (char *)dg0.acquire(1), cout.flush(); 
    5354                tools::os::microSleep(1000); 
     
    7273processLocked(void *ud) 
    7374{ 
    74         sec.acquire(); 
    75          
     75        sync::protector pg(&sec); 
     76 
    7677        cout << "processLocked:" << (char *)ud << endl, cout.flush(); 
    7778 
     
    8485                char *dt = (char *)shD.map(size); 
    8586                cout << "Data: " << dt << endl, cout.flush(); 
    86                  
     87 
    8788                cout << (char *)dgC.get(dgCI), cout.flush(); 
    88          
     89 
    8990                cout << (char *)dg0.acquire(), cout.flush(); 
    9091                dg0.release(); 
     
    9394 
    9495                tools::os::sleep(1); 
    95                  
     96 
    9697                cout << (char *)dg1.acquire(), cout.flush(); 
    9798                dg1.release(); 
     
    103104                cout << (dodoString)ex << ex.line << endl, cout.flush(); 
    104105        } 
    105  
    106         sec.release(); 
    107106 
    108107        return 0; 
Note: See TracChangeset for help on using the changeset viewer.