pike.git / lib / modules / Sql.pmod / pgsql.pike

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:210:    this::database = database;    _options = options || ([]);       if(!host) host = PGSQL_DEFAULT_HOST;    if(has_value(host,":") && sscanf(host,"%s:%d",host,_port)!=2)    ERROR("Error in parsing the hostname argument\n");    this::_host = host;       if(!_port)    _port = PGSQL_DEFAULT_PORT; -  .pgsql_util.register_backend(); +  +  // FIXME Looks like a bug in the cloning of an object +  // If we do not loop here, and this function is called in two threads +  // simultaneously, *and* the .pgsql_util class has not been instantiated +  // yet, then Pike can throw an "Attempting to clone an unfinished program" +  // error. +  +  while(catch(.pgsql_util.register_backend())) // Placate race in cloning +  sleep(0); // Yield    _shortmux=Thread.Mutex();    reconnect();   }      //! @returns   //! The textual description of the last   //! server-related error. Returns @expr{0@} if no error has occurred   //! yet. It is not cleared upon reading (can be invoked multiple   //! times, will return the same result until a new error occurs).   //!