VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c@ 33475

最後變更 在這個檔案從33475是 33475,由 vboxsync 提交於 14 年 前

crOpenGL/wddm: multithreading fix

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 1.4 KB
 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_error.h"
8#include "cr_mem.h"
9#include "packer.h"
10#include <stdio.h>
11
12#ifdef CHROMIUM_THREADSAFE
13CRtsd _PackerTSD;
14int cr_packer_globals; /* dummy - for the sake of packer.def */
15#else
16int _PackerTSD; /* dummy - for the sake of packer.def */ /* drm1 */
17DLLDATA(CRPackContext) cr_packer_globals;
18#endif
19
20CRPackContext *crPackNewContext( int swapping )
21{
22#ifdef CHROMIUM_THREADSAFE
23 CRPackContext *pc = crCalloc(sizeof(CRPackContext));
24 if (!pc)
25 return NULL;
26 crInitMutex(&pc->mutex);
27#else
28 GET_PACKER_CONTEXT(pc);
29 crMemZero( pc, sizeof(CRPackContext));
30#endif
31 pc->swapping = swapping;
32 pc->Flush = NULL;
33 pc->SendHuge = NULL;
34 pc->updateBBOX = 0;
35 return pc;
36}
37
38void crPackDeleteContext(CRPackContext *pc)
39{
40#ifdef CHROMIUM_THREADSAFE
41 crFreeMutex(&pc->mutex);
42 crFree(pc);
43#endif
44}
45
46/* Set packing context for the calling thread */
47void crPackSetContext( CRPackContext *pc )
48{
49#ifdef CHROMIUM_THREADSAFE
50 crSetTSD( &_PackerTSD, pc );
51#else
52 CRASSERT( pc == &cr_packer_globals );
53 (void)pc;
54#endif
55}
56
57
58/* Return packing context for the calling thread */
59CRPackContext *crPackGetContext( void )
60{
61#ifdef CHROMIUM_THREADSAFE
62 return (CRPackContext *) crGetTSD( &_PackerTSD );
63#else
64 return &cr_packer_globals;
65#endif
66}
67
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette