📄 rvthread_.h
字号:
#if (0)
******************************************************************************
Filename :
Description :
******************************************************************************
Copyright (c) 1999 RADVision Inc.
************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision LTD.
No part of this publication may be reproduced in any form whatsoever
without written prior approval by RADVision LTD..
RADVision LTD. reserves the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
******************************************************************************
$Revision:$
$Date:$
$Author: S. Cipolli$
******************************************************************************
#endif
#ifndef RV_THREAD__H
#define RV_THREAD__H
#include <stddef.h>
#include "rvplatform.h"
#include "rvtypes.h"
#include "rvsem_.h"
/* The interfaces in the this file are not for general consumption. */
/* Use rvthread.h instead. */
/* WIN32 thread implementation */
#if defined(RV_THREAD_WIN32)
#include <windows.h>
#include <process.h>
typedef HANDLE RvThreadHandle;
typedef DWORD RvThreadId;
#define RV_THREADID_NONE (0)
#define rvThreadIdCopy(d, s) ((d) = (s))
#define rvThreadIdEqual(a, b) ((a) == (b))
#define rvThreadIdCurrent GetCurrentThreadId
/* POSIX thread implementation */
#elif defined(RV_THREAD_POSIX)
#include <errno.h>
#include <pthread.h>
typedef pthread_t RvThreadHandle;
typedef pthread_t RvThreadId;
#define RV_THREADID_NONE (0)
#define rvThreadIdCopy(d, s) ((d) = (s))
#define rvThreadIdEqual(a, b) (pthread_equal((a), (b)))
#define rvThreadIdCurrent pthread_self
/* VxWorks thread implementation */
#elif defined(RV_THREAD_VXWORKS)
#include "taskLib.h"
typedef int RvThreadHandle;
typedef int RvThreadId;
#define RV_THREADID_NONE (0)
#define rvThreadIdCopy(d, s) ((d) = (s))
#define rvThreadIdEqual(a, b) ((a) == (b))
#define rvThreadIdCurrent taskIdSelf
/* PSoS thread implementation */
#elif defined(RV_THREAD_PSOS)
#include <psos.h>
typedef unsigned long RvThreadHandle;
typedef unsigned long RvThreadId;
#define RV_THREADID_NONE (0)
#define rvThreadIdCopy(d, s) ((d) = (s))
#define rvThreadIdEqual(a, b) ((a) == (b))
RvThreadId rvThreadIdCurrent(void);
/* Nucleus thread implementation */
#elif defined(RV_THREAD_NUCLEUS)
#include "nucleus.h"
typedef NU_TASK RvThreadHandle; /* contains actual TCB */
typedef NU_TASK *RvThreadId;
#define RV_THREADID_NONE (NULL)
#define rvThreadIdCopy(d, s) ((d) = (s))
#define rvThreadIdEqual(a, b) ((a) == (b))
#define rvThreadIdCurrent NU_Current_Task_Pointer
#else
# error Unknown thread implementation
#endif
#define RV_THREAD_STATE_UNBORN 0
#define RV_THREAD_STATE_ALIVE 1
#define RV_THREAD_STATE_DEAD 2
#if defined(__cplusplus)
extern "C" {
#endif
/* Thread interface */
typedef struct RvThread_s {
RvSem_ sync;
int state;
#if defined(RV_THREAD_WIN32) || defined(RV_THREAD_NUCLEUS)
RvThreadHandle handle;
#endif
RvThreadId id;
void* stack;
char name[32];
int priority;
size_t stackSize;
void (*func)(struct RvThread_s*, void*);
void* data;
} RvThread_;
typedef void (*RvThread_MainCB)(RvThread_*, void*);
RvThread_* rvThreadConstruct_(RvThread_* t, const char* name,
int priority, size_t stackSize, RvThread_MainCB func, void* data);
void rvThreadDestruct_(RvThread_* t);
const char* rvThreadName_(RvThread_* t);
void rvThreadStart_(RvThread_* t);
RvBool rvThreadJoin_(RvThread_* t);
RvThread_* rvThreadCurrent_(void);
void rvThreadSleep_(unsigned int ms);
#if defined(__cplusplus)
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -