当前位置: 首页>>代码示例>>C++>>正文


C++ drain函数代码示例

本文整理汇总了C++中drain函数的典型用法代码示例。如果您正苦于以下问题:C++ drain函数的具体用法?C++ drain怎么用?C++ drain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LOG4CPLUS_INFO

int Database::flush() {
	int drainCount = 0;

	LOG4CPLUS_INFO(logger, "Flushing lists...");

	drainCount = drain();
	drainCount += drain();

	return drainCount;
}
开发者ID:yanguanglan,项目名称:imageHasher,代码行数:10,代码来源:Database.cpp

示例2: drain

 void GridTransceiver_Test::Test_DataRates() {
   GridTransceiver pt;
   for (u32 i = 0; i < 100; ++i) {
     if (i < 80 || (i%4 == 0)) {
       pt.Write(true, (const u8*) "abcdefghijklmnopqrstuvwxyz0123456789!!!!!!!!!!",strlen("abcdefghijklmnopqrstuvwxyz0123456789!!!!!!!!!!"));
       pt.Write(false,(const u8*) "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",strlen("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"));
     }
     pt.Advance(333333); // 1/3 million nanos = 1/3 ms
     drain(pt,true,i);
     drain(pt,false,i);
   }
 }
开发者ID:DaveAckley,项目名称:MFM,代码行数:12,代码来源:GridTransceiver_Test.cpp

示例3: pulse_close

static void pulse_close(void) {

  ENTER(__FUNCTION__);
    
  drain();

  connected = 0;

  if (mainloop)
    pa_threaded_mainloop_stop(mainloop);

    connected = 0;

  if (context) {
    SHOW_TIME("pa_context_disconnect (call)");
    pa_context_disconnect(context);
    pa_context_unref(context);
    context = NULL;
  }
  
  if (mainloop) {
  SHOW_TIME("pa_threaded_mainloop_free (call)");
    pa_threaded_mainloop_free(mainloop);
    mainloop = NULL;
  }
  SHOW_TIME("pulse_close (ret)");
  
}
开发者ID:AVGP,项目名称:speak.js,代码行数:28,代码来源:wave_pulse.cpp

示例4: wait_drain

static void wait_drain(struct ao *ao)
{
    struct priv *priv = ao->priv;
    drain(ao);
    if (!priv->paused)
        mp_sleep_us(1000000.0 * priv->buffered / ao->samplerate / priv->speed);
}
开发者ID:AddictXQ,项目名称:mpv,代码行数:7,代码来源:ao_null.c

示例5: wakeup

static void wakeup(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue) {
  GPR_TIMER_MARK("workqueue.wakeup", 0);
  grpc_error *err = grpc_wakeup_fd_wakeup(&workqueue->wakeup_fd);
  if (!GRPC_LOG_IF_ERROR("wakeupfd_wakeup", err)) {
    drain(exec_ctx, workqueue);
  }
}
开发者ID:wuyunhao,项目名称:grpc,代码行数:7,代码来源:workqueue_posix.c

示例6: conn_free

/*
 * Release the specified connection.
 * Certain actions may be performed before doing this:
 *      - drain of a single UDP packet if the socket type is SOCK_DGRAM
 */
void conn_free( connection_s *cp, int release_mem )
{
   struct service *sp ;

   if( cp == NULL )
      return;
      if( debug.on )
         msg( LOG_INFO, "conn_free", "freeing connection") ;

   sp = cp->co_sp ;

   if( (SVC_SOCKET_TYPE( sp ) == SOCK_DGRAM) && (SVC_IS_ACTIVE( sp )) )
      drain( cp->co_descriptor ) ;

   if ( SVC_RELE( sp ) == 0 ) {
      pset_remove( SERVICES( ps ), sp ) ;
      svc_release( sp );
   }
   cp->co_sp = NULL;

   if ( CONN_DESCRIPTOR( cp ) > 0 )
      CONN_CLOSE( cp ) ;

   CLEAR( *cp ) ;
   if (release_mem) {
      FREE_CONN( cp ) ;
   }
}
开发者ID:Veilen,项目名称:xinetd,代码行数:33,代码来源:connection.c

示例7: wave_close

int wave_close(void* theHandler)
{
  SHOW_TIME("wave_close > ENTER");
  static int aStopStreamCount = 0;

	// Avoid race condition by making sure this function only
	// gets called once at a time
	aStopStreamCount++;
	if (aStopStreamCount != 1)
	{
		SHOW_TIME("wave_close > LEAVE (stopStreamCount)");
		return 0;
	}

	int a_status = pthread_mutex_lock(&pulse_mutex);
	if (a_status)
	{
		SHOW("Error: pulse_mutex lock=%d (%s)\n", a_status, __FUNCTION__);
		aStopStreamCount = 0; // last action
		return PULSE_ERROR;
	}

	drain();

	pthread_mutex_unlock(&pulse_mutex);
	SHOW_TIME("wave_close (ret)");

	aStopStreamCount = 0; // last action
	return PULSE_OK;
}
开发者ID:iVoice,项目名称:SpokenNews,代码行数:30,代码来源:wave_pulse.cpp

示例8: flush

			void flush()
			{
				if ( ! deflatecontext.deflateoutflushed )
				{
					drain();

					deflatecontext.deflategloblist.terminate();

					{
						deflatecontext.deflateexlock.lock();

						if ( deflatecontext.deflateexceptionid != std::numeric_limits<uint64_t>::max() )
						{
							deflatecontext.deflateexlock.unlock();

							libmaus2::parallel::ScopePosixMutex Q(deflatecontext.deflateexlock);
							throw (*(deflatecontext.deflatepse));
						}
						else
						{
							deflatecontext.deflateexlock.unlock();
						}
					}

					// write default compressed block with size 0 (EOF marker)
					libmaus2::lz::BgzfDeflateBase eofBase;
					BgzfDeflateZStreamBaseFlushInfo const eofflushsize = eofBase.flush(true /* full flush */);
					assert ( ! eofflushsize.movesize );
					deflatecontext.streamWrite(eofBase.inbuf.begin(),eofBase.outbuf.begin(),eofflushsize);

					deflatecontext.deflateoutflushed = true;
				}
			}
开发者ID:gt1,项目名称:libmaus2,代码行数:33,代码来源:BgzfInflateDeflateParallel.hpp

示例9: get_delay

static double get_delay(struct ao *ao)
{
    struct priv *priv = ao->priv;

    drain(ao);

    // Note how get_delay returns the delay in audio device time (instead of
    // adjusting for speed), since most AOs seem to also do that.
    double delay = priv->buffered;

    // Drivers with broken EOF handling usually always report the same device-
    // level delay that is additional to the buffer time.
    if (priv->broken_eof && priv->buffered < priv->latency)
        delay = priv->latency;

    delay /= ao->samplerate;

    if (priv->broken_delay) { // Report only multiples of outburst
        double q = priv->outburst / (double)ao->samplerate;
        if (delay > 0)
            delay = (int)(delay / q) * q;
    }

    return delay;
}
开发者ID:AddictXQ,项目名称:mpv,代码行数:25,代码来源:ao_null.c

示例10: pause

// stop playing, keep buffers (for pause)
static void pause(struct ao *ao)
{
    struct priv *priv = ao->priv;

    drain(ao);
    priv->paused = true;
}
开发者ID:AddictXQ,项目名称:mpv,代码行数:8,代码来源:ao_null.c

示例11: finish

static
int finish(struct audio_finish *finish)
{
  int i, result = 0;

  if (opened) {
    if (drain() == -1)
      result = -1;
    if (close_dev(wave_handle) == -1)
      result = -1;
  }

  /* restore priority status */

  SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
  SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);

  for (i = 0; i < NBUFFERS; ++i) {
    if (CloseHandle(output[i].event_handle) == 0 && result == 0) {
      audio_error = _("failed to close synchronization object");
      result = -1;
    }
  }

  return result;
}
开发者ID:Rambonuaa,项目名称:BoundCheck4,代码行数:26,代码来源:audio_win32.c

示例12: dereference_impl

 wchar_t dereference_impl() {
     if(! m_full){
         m_current_value = drain();
         m_full = true;
     }
     return m_current_value;
 }
开发者ID:ArthurHenriqueDellaFraga,项目名称:INE5426.Compiladores,代码行数:7,代码来源:wchar_from_mb.hpp

示例13: di_exit

void di_exit(void)
{
   struct intercept_s *ip = &dgram_intercept_state ;

   if ( IDP( ip->int_priv )->received_packets == 0 )
      drain( INT_REMOTE( ip ) ) ;
   int_exit( ip ) ;
}
开发者ID:a5216652166,项目名称:rcp100,代码行数:8,代码来源:udpint.c

示例14: resume

// resume playing, after pause()
static void resume(struct ao *ao)
{
    struct priv *priv = ao->priv;

    drain(ao);
    priv->paused = false;
    priv->last_time = mp_time_sec();
}
开发者ID:AddictXQ,项目名称:mpv,代码行数:9,代码来源:ao_null.c

示例15: get_space

static int get_space(struct ao *ao)
{
    struct priv *priv = ao->priv;

    drain(ao);
    int samples = priv->buffersize - priv->latency - priv->buffered;
    return samples / priv->outburst * priv->outburst;
}
开发者ID:AddictXQ,项目名称:mpv,代码行数:8,代码来源:ao_null.c


注:本文中的drain函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。