本文整理汇总了C++中STATUS函数的典型用法代码示例。如果您正苦于以下问题:C++ STATUS函数的具体用法?C++ STATUS怎么用?C++ STATUS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STATUS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wiProcess_CreateMutex
// ================================================================================================
// FUNCTION : wiProcess_CreateMutex()
// ------------------------------------------------------------------------------------------------
// Purpose : Create a mutext object to be used by the WaitForMutex and ReleaseMutex functions.
// ================================================================================================
wiStatus wiProcess_CreateMutex(wiMutex_t *pMutex)
{
#ifdef WISE_BUILD_MULTITHREADED
#if defined WISE_USE_PTHREADS
int rc = pthread_mutex_init( pMutex, NULL );
if (rc != 0)
{
wiUtil_WriteLogFile("pthread_mutex_init returnd %d\n",rc);
return STATUS(WI_ERROR);
}
#elif defined WIN32
*pMutex = CreateMutex(NULL, FALSE, NULL);
if (*pMutex == NULL) {
wiUtil_WriteLogFile("CreateMutex error: %d\n", GetLastError());
return STATUS(WI_ERROR);
}
#else
return WI_ERROR_NO_MULTITHREAD_SUPPORT;
#endif
#else
*pMutex = NULL;
#endif
return WI_SUCCESS;
}
示例2: wiPHY_SelectMethod
// ================================================================================================
// FUNCTION : wiPHY_SelectMethod
// ------------------------------------------------------------------------------------------------
// Purpose : Selects the active method
// Parameters: method -- Method to be selected
// ================================================================================================
wiStatus wiPHY_SelectMethod(wiPhyMethod_t *method)
{
if (Verbose) wiPrintf(" wiPHY_SelectMethod(*)\n");
if (!Initialized) return WI_ERROR_MODULE_NOT_INITIALIZED;
if (!method) return WI_ERROR_PARAMETER1;
// -----------------------------------------------------------
// If the selected method is different than the current one...
// -----------------------------------------------------------
if (method != ActiveMethod)
{
// Close the previous method
// -------------------------
if (ActiveMethod)
{
STATUS(ActiveMethod->fn(WIPHY_CLOSE_ALL_THREADS, NULL));
STATUS(ActiveMethod->fn(WIPHY_POWER_OFF, NULL));
}
// Open the new method
// -------------------
ActiveMethod = method;
STATUS( ActiveMethod->fn(WIPHY_POWER_ON, NULL));
}
return WI_SUCCESS;
}
示例3: owner_modify
static int owner_modify(void)
{
char *tmp;
ne_propname pname = { "http://webdav.org/neon/litmus/", "random" };
ne_proppatch_operation pops[] = {
{ NULL, ne_propset, "foobar" },
{ NULL }
};
PRECOND(gotlock);
ONV(ne_put(i_session, res, i_foo_fd),
("PUT on locked resource failed: %s", ne_get_error(i_session)));
tmp = ne_concat(i_path, "whocares", NULL);
ONN("COPY of locked resource",
ne_copy(i_session, 1, NE_DEPTH_ZERO, res, tmp) == NE_ERROR);
if (STATUS(201))
t_warning("COPY failed with %d not 201", GETSTATUS);
ONN("DELETE of locked resource by owner",
ne_delete(i_session, tmp) == NE_ERROR);
if (STATUS(204))
t_warning("DELETE of %s failed with %d not 200", tmp, GETSTATUS);
free(tmp);
ONN("PROPPATCH of locked resource",
ne_proppatch(i_session, res, pops) == NE_ERROR);
if (STATUS(207))
t_warning("PROPPATCH failed with %d", GETSTATUS);
return OK;
}
示例4: switch
void FORTE_BL_IX::executeEvent(int pa_nEIID){
switch(pa_nEIID){
case scm_nEventINITID:
delete m_poGPIO;
m_poGPIO = NULL;
if(QI() == true){
char * pacBuffer = new char[PARAMS().length() + 3];
PARAMS().toString(pacBuffer, sizeof(char)*(PARAMS().length() + 3));
if (verifyInput(pacBuffer, PARAMS().length() + 2)){
STATUS() = "OK";
QO() = true;
}else{
STATUS() = "Input PARAM error";
QO() = false;
}
delete[] pacBuffer;
}else{
STATUS() = "INIT- OK";
QO() = false;
}
sendOutputEvent(scm_nEventINITOID);
break;
case scm_nEventREQID:
if(m_poGPIO != NULL){
IN() = m_poGPIO->isHigh();
STATUS() = "OK";
}else{
IN() = false;
STATUS() = "Not initialized";
}
sendOutputEvent(scm_nEventCNFID);
break;
}
}
示例5: elvis_CB
void elvis_CB( Widget w , XtPointer cd , XtPointer cb )
{
XmDrawingAreaCallbackStruct * cbs = (XmDrawingAreaCallbackStruct *) cb ;
XExposeEvent * ev = (XExposeEvent *) cbs->event ;
int start , end ;
static int ncall = 0 ;
if( cbs->reason != XmCR_EXPOSE || ev->count > 0 ) return ;
STATUS("enter elvis_CB") ;
if( need_plot ){
make_plot() ;
set_X11_background( XtDisplay(w) , XtWindow(w) , 255,255,255 ) ;
}
XClearWindow( XtDisplay(w) , XtWindow(w) ) ;
#if 1
if( ncall%2 == 0 ) set_active_memplot( "Elvis" ) ;
else set_active_memplot( "Pelvis" ) ;
ncall++ ;
#endif
STATUS("XClearWindow") ;
start = end = 0 ;
#if 0
memplot_to_X11( XtDisplay(w) , XtWindow(w) ) ;
#else
memplot_to_X11_free( XtDisplay(w) , XtWindow(w) ) ;
#endif
return ;
}
示例6: QO
void FORTE_Digital::executeEvent(int pa_nEIID){
QO() = QI();
STATUS() = 0;
switch (pa_nEIID){
case scm_nEventINITID:
if(true == QI()){
libcbc_init(); //TODO: only call once //initialises the CBC Library :)
if(PORT() >= 8 && PORT() <= 15){ //digital PORTS!!
m_nPort = PORT();
}
}
else{
QO() = false;
STATUS() = 1;
}
sendOutputEvent(scm_nEventINITOID);
break;
case scm_nEventREQID:
if(true == QI()){
STATUS() = digital(m_nPort);
}
sendOutputEvent(scm_nEventCNFID);
break;
}
}
示例7: main
int main(void)
{
{
TEST();
EXPECT(widthof(long long) >= widthof(long));
EXPECT(widthof(long) >= widthof(int));
EXPECT(widthof(int) >= widthof(short));
EXPECT(widthof(short) >= widthof(char));
EXPECT(widthof(double) >= widthof(float));
ADVISE(widthof(double) > widthof(float)); /* Not true on some targets. */
STATUS();
}
{
TEST();
EXPECT(widthof(int64_t) == 64);
EXPECT(widthof(uint64_t) == 64);
EXPECT(widthof(int32_t) == 32);
EXPECT(widthof(uint32_t) == 32);
EXPECT(widthof(int16_t) == 16);
EXPECT(widthof(uint16_t) == 16);
EXPECT(widthof(int8_t) == 8);
EXPECT(widthof(uint8_t) == 8);
EXPECT(widthof(intptr_t) == widthof(void *));
EXPECT(widthof(uintptr_t) == widthof(void *));
STATUS();
}
EXIT();
}
示例8: configASIC
static int
configASIC(Ether* ether, int port, int xcvr)
{
int x;
/* set Window 0 configuration registers */
COMMAND(port, SelectRegisterWindow, Wsetup);
outs(port+ConfigControl, Ena);
/* IRQ must be 3 on 3C589/3C562 */
outs(port + ResourceConfig, 0x3F00);
x = ins(port+AddressConfig) & ~xcvrMask9;
x |= (xcvr>>20)<<14;
outs(port+AddressConfig, x);
COMMAND(port, TxReset, 0);
while(STATUS(port) & commandInProgress)
;
COMMAND(port, RxReset, 0);
while(STATUS(port) & commandInProgress)
;
return etherelnk3reset(ether);
}
示例9: copy_overwrite
static int copy_overwrite(void)
{
PRECOND(copy_ok);
/* Do it again with Overwrite: F to check that fails. */
ONN("COPY on existing resource with Overwrite: F should fail (RFC2518:S8.8.4)",
ne_copy(i_session, 0, NE_DEPTH_INFINITE, src, dest) != NE_ERROR);
if (STATUS(412)) {
t_warning("COPY-on-existing fails with 412");
}
ONV(ne_copy(i_session, 1, NE_DEPTH_INFINITE, src, dest),
("COPY-on-existing with 'Overwrite: T' should succeed (RFC2518:S8.8.4): %s", ne_get_error(i_session)));
/* tricky one this, I didn't think it should work, but the spec
* makes it look like it should. */
ONV(ne_copy(i_session, 1, NE_DEPTH_INFINITE, src, coll),
("COPY overwrites collection: %s", ne_get_error(i_session)));
if (STATUS(204)) {
t_warning("COPY to existing resource didn't give 204 (RFC2518:S8.8.5)");
}
return OK;
}
示例10: wiProcess_Init
// ================================================================================================
// FUNCTION : wiProcess_Init()
// ------------------------------------------------------------------------------------------------
// ================================================================================================
wiStatus wiProcess_Init(void)
{
if (ModuleIsInitialized) return STATUS(WI_ERROR_MODULE_ALREADY_INIT);
#ifdef WISE_BUILD_MULTITHREADED
#if defined WISE_USE_PTHREADS
pthread_key_create(&wiProcessKey, NULL);
#elif defined WIN32
{
LPVOID lpvData = (LPVOID) LocalAlloc(LPTR, sizeof(int));
if (!lpvData) return STATUS(WI_ERROR_MEMORY_ALLOCATION);
// Allocate thread-local memory used to store ThreadIndex
dwTlsIndex = TlsAlloc();
TlsSetValue(dwTlsIndex, lpvData);
(*(int *)lpvData) = 0;
}
#else
XSTATUS( WI_ERROR );
#endif
#endif
ModuleIsInitialized = WI_TRUE;
return WI_SUCCESS;
}
示例11: wiProcess_ReleaseMutex
// ================================================================================================
// FUNCTION : wiProcess_ReleaseMutex()
// ------------------------------------------------------------------------------------------------
// Purpose : Release the mutex obtained with wiProcess_WaitForMutex()
// ================================================================================================
wiStatus wiProcess_ReleaseMutex(wiMutex_t *pMutex)
{
#ifdef WISE_BUILD_MULTITHREADED
if (ModuleIsInitialized)
{
#if defined WISE_USE_PTHREADS
int rc = pthread_mutex_unlock( pMutex );
if (rc != 0)
{
wiUtil_WriteLogFile("pthread_mutex_unlock result = %d\n",rc);
return WI_ERROR;
}
#elif defined WIN32
if (!ReleaseMutex( *((HANDLE *)pMutex) ) )
{
wiUtil_WriteLogFile("ReleaseMutex failed\n");
return STATUS(WI_ERROR);
}
#else
return STATUS(WI_ERROR_NO_MULTITHREAD_SUPPORT);
#endif
}
#endif
return WI_SUCCESS;
}
示例12: wiProcess_CloseMutex
// ================================================================================================
// FUNCTION : wiProcess_CloseMutex()
// ------------------------------------------------------------------------------------------------
// Purpose : Close the Mutex object created with wiProcess_CreateMutex
// ================================================================================================
wiStatus wiProcess_CloseMutex(wiMutex_t *pMutex)
{
#ifdef WISE_BUILD_MULTITHREADED
#if defined WISE_USE_PTHREADS
int rc = pthread_mutex_destroy( pMutex );
if (rc != 0)
{
wiUtil_WriteLogFile("pthread_mutex_destroy returnd %d\n",rc);
return STATUS(WI_ERROR);
}
#elif defined WIN32
if (!CloseHandle(*pMutex)) {
wiUtil_WriteLogFile("CloseHandle error: %d\n", GetLastError());
return STATUS(WI_ERROR);
}
#else
return STATUS(WI_ERROR_NO_MULTITHREAD_SUPPORT);
#endif
#endif
return WI_SUCCESS;
}
示例13: gst_data_queue_push_force
/**
* gst_data_queue_push_force: (skip)
* @queue: a #GstDataQueue.
* @item: a #GstDataQueueItem.
*
* Pushes a #GstDataQueueItem (or a structure that begins with the same fields)
* on the @queue. It ignores if the @queue is full or not and forces the @item
* to be pushed anyway.
* MT safe.
*
* Note that this function has slightly different semantics than gst_pad_push()
* and gst_pad_push_event(): this function only takes ownership of @item and
* the #GstMiniObject contained in @item if the push was successful. If %FALSE
* is returned, the caller is responsible for freeing @item and its contents.
*
* Returns: %TRUE if the @item was successfully pushed on the @queue.
*
* Since: 1.2
*/
gboolean
gst_data_queue_push_force (GstDataQueue * queue, GstDataQueueItem * item)
{
GstDataQueuePrivate *priv = queue->priv;
g_return_val_if_fail (GST_IS_DATA_QUEUE (queue), FALSE);
g_return_val_if_fail (item != NULL, FALSE);
GST_DATA_QUEUE_MUTEX_LOCK_CHECK (queue, flushing);
STATUS (queue, "before pushing");
gst_data_queue_push_force_unlocked (queue, item);
STATUS (queue, "after pushing");
if (priv->waiting_add)
g_cond_signal (&priv->item_add);
GST_DATA_QUEUE_MUTEX_UNLOCK (queue);
return TRUE;
/* ERRORS */
flushing:
{
GST_DEBUG ("queue:%p, we are flushing", queue);
GST_DATA_QUEUE_MUTEX_UNLOCK (queue);
return FALSE;
}
}
示例14: wiProcess_InitializeThreadIndex
// ================================================================================================
// FUNCTION : wiProcess_InitializeThreadIndex()
// ------------------------------------------------------------------------------------------------
// ================================================================================================
wiStatus wiProcess_InitializeThreadIndex(unsigned ThreadIndex)
{
if (InvalidRange(ThreadIndex, 1, WISE_MAX_THREADINDEX)) return WI_ERROR_PARAMETER1;
#if defined WISE_USE_PTHREADS
{
void *lpvData = wiMalloc(sizeof(int));
if (!lpvData) return STATUS(WI_ERROR_MEMORY_ALLOCATION);
pthread_setspecific(wiProcessKey, lpvData);
(*(unsigned int *)lpvData) = ThreadIndex;
return WI_SUCCESS;
}
#elif defined WIN32
{
LPVOID lpvData;
lpvData = (LPVOID) LocalAlloc(LPTR, sizeof(int));
TlsSetValue(dwTlsIndex, lpvData);
(*(unsigned int *)lpvData) = ThreadIndex;
return WI_SUCCESS;
}
#else
return STATUS(WI_ERROR_NO_MULTITHREAD_SUPPORT);
#endif
}
示例15: wiMemory_traceCalloc
// ================================================================================================
// FUNCTION : wiMemory_traceCalloc()
// ------------------------------------------------------------------------------------------------
// ================================================================================================
void * wiMemory_traceCalloc(size_t nitems, size_t size)
{
void *ptr = NULL;
STATUS(wiProcess_WaitForMutex(&TraceMemoryMutex));
STATUS(wiMemory_AddTraceBlock(nitems*size, &ptr));
STATUS(wiProcess_ReleaseMutex(&TraceMemoryMutex));
return ptr;
}