Linux下C++类的线程函数
最近在用C++编写一个RTSP的客户端,由于要用到线程,根据C编程的经验,写了如下代码:
class LiRtspSession
{
public:
void* MainThreadFunc(void* pvData);
void* AudioProcThreadFunc(void* pvData);
void Connect();
//省略的代码
private:
pthread_t m_hProcHandle, m_hAudioProcHandle;
//省略的代码
};
void LiRtspSession::Connect()
{
//create main thread creating rtsp session and receiving rtp/rtcp packet
int ret = pthread_create(&m_hProcHandle, NULL, MainThreadFunc, this);
if(ret != 0)
{
return;
}
//create a thread receiving audio data
if(m_bAudioEnabled && m_eProtoType == ptUDP);
{
ret = pthread_create(&m_hAudioProcHandle, NULL, AudioProcThreadFunc, this);
if(ret != 0)
{
return;
}
}
pthread_join(m_hProcHandle, NULL);
if(m_bAudioEnabled && m_eProtoType == ptUDP);
{
pthread_join(m_hAudioProcHandle, NULL);
}
}
但是在编译时却出现如下错误:
LiRtspSession.cpp: In member function ‘void LiRtspSession::Connect()’:
LiRtspSession.cpp:176: error: argume
相关文档:
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
1.谈到linux的文件系统,我们必须关注/etc/fstab文件的内容;在linux中的所有挂载分区和设备都在fstab表格中。
/etc/fstab表格中的选择项参数定义如下:
ro or rw
Read only or read write
noauto
Do not respond to mount -a. Used for external devices CDROMs ...
noexec
Executables cannot be started from the ......
在这里整理一下我所熟悉的linux命令,这些命令应该是使用linux运营一个网站所需的基本命令,供想学习使用linux的同事参考。
大家也可以补充一些在工作中常用到的命令,只列系统命令和基本shell脚本,不涉及apache、tomcat、ftp、mysql管理。
我只列出命令和常见的参数组合,含义就不解释了,大家问问google都会得到 ......
当内存出现不够用的时候,oom-killer会kill掉一些进程
这个信息可以在/var/log/messger里查到
当这种情况出现的时候,可以将系统里一些nattach为0的shm清理掉
关于高低端内存的问题可以看如下
Since this problem seems to popup on different lists, this message has
been cross-posted to the general Red Hat disc ......