基于qt,msvc2017-64bits,ffmpeg.opengl的播放器
chenshijun
2020-12-03 9e8804424408db79fcdb229a016ac87952e4e0f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef COND_H
#define COND_H
 
/// ×¢ÒâMingwµÄ»°Ê¹ÓõÄÊÇlinuxϵÄapi pthread
/// Ã»ÓÐ_MSC_VERÕâ¸öºê ÎÒÃǾÍÈÏΪËûÓõÄÊÇmingw±àÒëÆ÷
 
#ifndef _MSC_VER
#define MINGW
#endif
 
#if defined(WIN32) && !defined(MINGW)
    #include <WinSock2.h>
    #include <Windows.h>
#else
    #include <pthread.h>
    #include <time.h>
#endif
 
class Cond
{
public:
    Cond();
    ~Cond();
 
    //ÉÏËø
    int Lock();
 
    //½âËø
    int Unlock();
 
    //
    int Wait();
 
    //¹Ì¶¨Ê±¼äµÈ´ý
    int TimedWait(int second);
 
    //
    int Signal();
 
    //»½ÐÑËùÓÐ˯ÃßÏß³Ì
    int Broadcast();
 
private:
 
#if defined(WIN32) && !defined(MINGW)
    CRITICAL_SECTION m_mutex;
    RTL_CONDITION_VARIABLE m_cond;
#else
    pthread_mutex_t m_mutex;
    pthread_cond_t m_cond;
#endif
 
};
 
#endif // MUTEX_H