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


C++ MUTEX_INIT函数代码示例

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


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

示例1: MUTEX_INIT

bool
OMR::Monitor::init(char *name)
   {
   _name = name;
   MUTEX_INIT(_monitor);
   bool rc = MUTEX_INIT(_monitor);
   TR_ASSERT(rc == true, "error initializing monitor\n");
   return true;
   }
开发者ID:TianyuZuo,项目名称:omr,代码行数:9,代码来源:OMRMonitor.cpp

示例2: Logger

LoadBalancer::LoadBalancer(){
	logger = new Logger(log_path);   //日志类初始化
	ClientRecvCorrectCount=ClientRecvIncorrectCount=ClientSendCount = 0;
	ServerRecvCorrectCount=ServerRecvIncorrectCount=ServerSendCount = 0;
	initilize(conf_path);
	initilize_socket();
	MUTEX_INIT(mutex_sendto);
	MUTEX_INIT(mutex_print);
	
}
开发者ID:jk983294,项目名称:Store,代码行数:10,代码来源:LoadBalancer.cpp

示例3: initilize

Client::Client(unsigned id,unsigned usr_id, unsigned n){
	this->id = id;	this->usr_id = usr_id;	this->n = n;
	RecvCorrectCount=RecvIncorrectCount=SendCount = 0;
	initilize(conf_path);
	if (! SocketUtil::create_udp_socket(mysocket))
		print_debugInformation("创建client socket错误");
	isdebug = true;
	MUTEX_INIT(mutex_sendto);
	MUTEX_INIT(mutex_print);
}
开发者ID:jk983294,项目名称:Store,代码行数:10,代码来源:client.cpp

示例4: freerdp_chanman_init

/* this is called shortly after the application starts and
   before any other function in the file
   called only from main thread */
int
freerdp_chanman_init(void)
{
	g_init_chan_man = NULL;
	g_chan_man_list = NULL;
	g_open_handle_sequence = 1;
	MUTEX_INIT(g_mutex_init);
	MUTEX_INIT(g_mutex_list);

	return 0;
}
开发者ID:g-reno,项目名称:FreeRDP-old,代码行数:14,代码来源:libchanman.c

示例5: _hwnd

VDAgent::VDAgent()
    : _hwnd (NULL)
    , _hwnd_next_viewer (NULL)
    , _user_lib (NULL)
    , _add_clipboard_listener (NULL)
    , _remove_clipboard_listener (NULL)
    , _clipboard_owner (owner_none)
    , _clipboard_tick (0)
    , _buttons_state (0)
    , _mouse_x (0)
    , _mouse_y (0)
    , _input_time (0)
    , _control_event (NULL)
    , _stop_event (NULL)
    , _in_msg (NULL)
    , _in_msg_pos (0)
    , _pending_input (false)
    , _running (false)
    , _desktop_switch (false)
    , _desktop_layout (NULL)
    , _display_setting (VD_AGENT_REGISTRY_KEY)
    , _vio_serial (NULL)
    , _read_pos (0)
    , _write_pos (0)
    , _logon_desktop (false)
    , _display_setting_initialized (false)
    , _max_clipboard (-1)
    , _client_caps (NULL)
    , _client_caps_size (0)
    , _log (NULL)
{
    TCHAR log_path[MAX_PATH];
    TCHAR temp_path[MAX_PATH];

    _system_version = supported_system_version();
    if (GetTempPath(MAX_PATH, temp_path)) {
        swprintf_s(log_path, MAX_PATH, VD_AGENT_LOG_PATH, temp_path);
        _log = VDLog::get(log_path);
    }
    ZeroMemory(&_input, sizeof(_input));
    ZeroMemory(&_read_overlapped, sizeof(_read_overlapped));
    ZeroMemory(&_write_overlapped, sizeof(_write_overlapped));
    ZeroMemory(_read_buf, sizeof(_read_buf));
    MUTEX_INIT(_control_mutex);
    MUTEX_INIT(_message_mutex);

    _singleton = this;
}
开发者ID:freedesktop-unofficial-mirror,项目名称:spice__win32__vd_agent,代码行数:48,代码来源:vdagent.cpp

示例6: _tdispInit

void _tdispInit(void) {
	MUTEX_INIT();

	MUTEX_ENTER();
	tdisp_lld_init();
	MUTEX_LEAVE();
}
开发者ID:sam0737,项目名称:ugfx-rads,代码行数:7,代码来源:tdisp.c

示例7: init_keepers

/*
* Initialize keeper states
*
* If there is a problem, return an error message (NULL for okay).
*
* Note: Any problems would be design flaws; the created Lua state is left
*       unclosed, because it does not really matter. In production code, this
*       function never fails.
*/
char const* init_keepers( int const _nbKeepers, lua_CFunction _on_state_create)
{
	int i;
	assert( _nbKeepers >= 1);
	GNbKeepers = _nbKeepers;
	GKeepers = malloc( _nbKeepers * sizeof( struct s_Keeper));
	for( i = 0; i < _nbKeepers; ++ i)
	{

		// We need to load all base libraries in the keeper states so that the transfer databases are populated properly
		// 
		// 'io' for debugging messages, 'package' because we need to require modules exporting idfuncs
		// the others because they export functions that we may store in a keeper for transfer between lanes
		lua_State* K = luaG_newstate( "*", _on_state_create);
		if (!K)
			return "out of memory";

		STACK_CHECK( K)
		// to see VM name in Decoda debugger
		lua_pushliteral( K, "Keeper #");
		lua_pushinteger( K, i + 1);
		lua_concat( K, 2);
		lua_setglobal( K, "decoda_name");

#if KEEPER_MODEL == KEEPER_MODEL_C
		// create the fifos table in the keeper state
		lua_pushlightuserdata( K, fifos_key);
		lua_newtable( K);
		lua_rawset( K, LUA_REGISTRYINDEX);
#endif // KEEPER_MODEL == KEEPER_MODEL_C

#if KEEPER_MODEL == KEEPER_MODEL_LUA
		// use package.loaders[2] to find keeper microcode
		lua_getglobal( K, "package");                  // package
		lua_getfield( K, -1, "loaders");               // package package.loaders
		lua_rawgeti( K, -1, 2);                        // package package.loaders package.loaders[2]
		lua_pushliteral( K, "lanes-keeper");           // package package.loaders package.loaders[2] "lanes-keeper"
		STACK_MID( K, 4);
		// first pcall loads lanes-keeper.lua, second one runs the chunk
		if( lua_pcall( K, 1 /*args*/, 1 /*results*/, 0 /*errfunc*/) || lua_pcall( K, 0 /*args*/, 0 /*results*/, 0 /*errfunc*/))
		{
			// LUA_ERRRUN / LUA_ERRMEM / LUA_ERRERR
			//
			char const* err = lua_tostring( K, -1);
			assert( err);
			return err;
		}                                              // package package.loaders
		STACK_MID( K, 2);
		lua_pop( K, 2);
#endif // KEEPER_MODEL == KEEPER_MODEL_LUA
		STACK_END( K, 0)
		MUTEX_INIT( &GKeepers[i].lock_);
		GKeepers[i].L = K;
		//GKeepers[i].count = 0;
	}
#if HAVE_KEEPER_ATEXIT_DESINIT
	atexit( atexit_close_keepers);
#endif // HAVE_KEEPER_ATEXIT_DESINIT
	return NULL;    // ok
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:69,代码来源:keeper.c

示例8: MUTEX_INIT

/* initialize */
MMKEY *mmkey_init(char *file)
{
    MMKEY *mmkey = NULL;
    struct stat st = {0};
    int fd = 0;

    if(file && (fd = open(file, O_CREAT|O_RDWR, 0644)) > 0)
    {
        if((mmkey = (MMKEY *)calloc(1, sizeof(MMKEY))))
        {
            MUTEX_INIT(mmkey->mutex);
            mmkey->fd          = fd;
            fstat(fd, &st);
            mmkey->file_size   = st.st_size;
            MMKEY_MAP_INIT(mmkey);
            mmkey->add         = mmkey_add;
            mmkey->xadd        = mmkey_xadd;
            mmkey->get         = mmkey_get;
            mmkey->del         = mmkey_del;
            mmkey->find        = mmkey_find;
            mmkey->maxfind     = mmkey_maxfind;
            mmkey->radd        = mmkey_radd;
            mmkey->rxadd       = mmkey_rxadd;
            mmkey->rget        = mmkey_rget;
            mmkey->rdel        = mmkey_rdel;
            mmkey->rfind       = mmkey_rfind;
            mmkey->rmaxfind    = mmkey_rmaxfind;
            mmkey->clean       = mmkey_clean;
        }
        else 
            close(fd);
    }
    return mmkey;
}
开发者ID:cnangel,项目名称:hidbase,代码行数:35,代码来源:mmkey.c

示例9: perf_datafile_open

perf_datafile_t *
perf_datafile_open(isc_mem_t *mctx, const char *filename)
{
	perf_datafile_t *dfile;
	struct stat buf;

	dfile = isc_mem_get(mctx, sizeof(*dfile));
	if (dfile == NULL)
		perf_log_fatal("out of memory");

	dfile->mctx = mctx;
	MUTEX_INIT(&dfile->lock);
	dfile->pipe_fd = -1;
	dfile->is_file = ISC_FALSE;
	dfile->size = 0;
	dfile->cached = ISC_FALSE;
	dfile->maxruns = 1;
	dfile->nruns = 0;
	dfile->read_any = ISC_FALSE;
	isc_buffer_init(&dfile->data, dfile->databuf, BUFFER_SIZE);
	if (filename == NULL) {
		dfile->fd = STDIN_FILENO;
	} else {
		dfile->fd = open(filename, O_RDONLY);
		if (dfile->fd < 0)
			perf_log_fatal("unable to open file: %s", filename);
		if (fstat(dfile->fd, &buf) == 0 && S_ISREG(buf.st_mode)) {
			dfile->is_file = ISC_TRUE;
			dfile->size = buf.st_size;
		}
	}
	nul_terminate(dfile);

	return dfile;
}
开发者ID:NZRS,项目名称:bind9-collab,代码行数:35,代码来源:datafile.c

示例10: afs_tp_create

/**
 * create a thread pool.
 *
 * @param[inout] pool_out  address in which to store pool object pointer.
 * @param[in]    queue     work queue serviced by thread pool
 *
 * @return operation status
 *    @retval 0 success
 *    @retval ENOMEM out of memory
 */
int
afs_tp_create(struct afs_thread_pool ** pool_out,
              struct afs_work_queue * queue)
{
    int ret = 0;
    struct afs_thread_pool * pool;

    ret = _afs_tp_alloc(pool_out);
    if (ret) {
        goto error;
    }
    pool = *pool_out;

    MUTEX_INIT(&pool->lock, "pool", MUTEX_DEFAULT, 0);
    CV_INIT(&pool->shutdown_cv, "pool shutdown", CV_DEFAULT, 0);
    queue_Init(&pool->thread_list);
    pool->work_queue = queue;
    pool->entry = &_afs_tp_worker_default;
    pool->rock = NULL;
    pool->nthreads = 0;
    pool->max_threads = 4;
    pool->state = AFS_TP_STATE_INIT;

error:
    return ret;
}
开发者ID:sanchit-matta,项目名称:openafs,代码行数:36,代码来源:thread_pool.c

示例11: RWLOCK_INIT

bool Trace::ConnectToFileAndStart(char *filename, unsigned int trace_index, int register_size, int register_count, bool is_big_endian) {
  trace_index_ = trace_index;
  is_big_endian_ = is_big_endian;
  register_size_ = register_size;
  register_count_ = register_count;
  RWLOCK_INIT(db_lock_);
  MUTEX_INIT(backing_mutex_);

  registers_.resize(register_count_);

#ifdef _WIN32
  fd_ = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
#else
  fd_ = open(filename, O_RDONLY);
  if (fd_ == -1) {
    printf("ERROR: file open failed\n");
    return false;
  }
#endif

  if (!remap_backing(sizeof(struct change))) {
    printf("ERROR: remap backing failed\n");
    return false;
  }

  THREAD_CREATE(thread, thread_entry, this);
  return true;
}
开发者ID:BinaryAnalysisPlatform,项目名称:qira,代码行数:28,代码来源:Trace.cpp

示例12: fr_loginit

/* ------------------------------------------------------------------------ */
int fr_loginit()
{
	int	i;

	for (i = IPL_LOGMAX; i >= 0; i--) {
		iplt[i] = NULL;
		ipll[i] = NULL;
		iplh[i] = &iplt[i];
		iplused[i] = 0;
		bzero((char *)&iplcrc[i], sizeof(iplcrc[i]));
# ifdef	IPL_SELECT
		iplog_ss[i].read_waiter = 0;
		iplog_ss[i].state = 0;
# endif
# if defined(linux) && defined(_KERNEL)
		init_waitqueue_head(iplh_linux + i);
# endif
	}

# if SOLARIS && defined(_KERNEL)
	cv_init(&iplwait, "ipl condvar", CV_DRIVER, NULL);
# endif
	MUTEX_INIT(&ipl_mutex, "ipf log mutex");

	ipl_log_init = 1;

	return 0;
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:29,代码来源:ip_log.c

示例13: MUTEX_INIT

Logging::Logging(bool debug) {
	mDebug = debug;
	MUTEX_INIT();

	strcpy(mErrBuf, "Unknown Error");
	strcpy(mLogBuf, "Unknown Message");
}
开发者ID:CobraJet93,项目名称:kernel-3.10.54,代码行数:7,代码来源:Logging.cpp

示例14: TEST

TEST(Mutex, test) {
    MUTEX mx;
    MUTEX_INIT(mx);
    MUTEX_LOCK(mx);
    MUTEX_UNLOCK(mx);
    MUTEX_DESTROY(mx);
}
开发者ID:leonindy,项目名称:cat,代码行数:7,代码来源:test_concurrent.cpp

示例15: atomic_new

atomic atomic_new(long int x) {
   atomic a;
   a=malloc(sizeof(struct atomicInt));
   a->i=x;
   MUTEX_INIT(&a->lock);
   return a;
}
开发者ID:salmito,项目名称:leda,代码行数:7,代码来源:atomic.c


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