author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
/* |
sl@0 | 2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 3 |
* All rights reserved. |
sl@0 | 4 |
* This component and the accompanying materials are made available |
sl@0 | 5 |
* under the terms of "Eclipse Public License v1.0" |
sl@0 | 6 |
* which accompanies this distribution, and is available |
sl@0 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 8 |
* |
sl@0 | 9 |
* Initial Contributors: |
sl@0 | 10 |
* Nokia Corporation - initial contribution. |
sl@0 | 11 |
* |
sl@0 | 12 |
* Contributors: |
sl@0 | 13 |
* |
sl@0 | 14 |
* Description: |
sl@0 | 15 |
* Name : threadcreate.h |
sl@0 | 16 |
* Part of : PThread library |
sl@0 | 17 |
* Data structure needed for thread creatation. |
sl@0 | 18 |
* Version: |
sl@0 | 19 |
* |
sl@0 | 20 |
*/ |
sl@0 | 21 |
|
sl@0 | 22 |
|
sl@0 | 23 |
|
sl@0 | 24 |
#ifndef THREADCREATE_H |
sl@0 | 25 |
#define THREADCREATE_H |
sl@0 | 26 |
|
sl@0 | 27 |
#include <e32std.h> |
sl@0 | 28 |
#include <sched.h> |
sl@0 | 29 |
#include "sysif.h" |
sl@0 | 30 |
|
sl@0 | 31 |
#define MIN_RR_PRIORITY 0 |
sl@0 | 32 |
#define MAX_RR_PRIORITY 255 |
sl@0 | 33 |
|
sl@0 | 34 |
// On any addition or deletion to this pthread_attr structure, update |
sl@0 | 35 |
// _TOTALSIZEOF_PTHREAD_ATTR_T |
sl@0 | 36 |
typedef struct |
sl@0 | 37 |
{ |
sl@0 | 38 |
/* Scheduler parameters; Only priority. */ |
sl@0 | 39 |
unsigned int policy; |
sl@0 | 40 |
unsigned int stackSize; |
sl@0 | 41 |
unsigned int detachState; |
sl@0 | 42 |
unsigned int scope; |
sl@0 | 43 |
struct sched_param sp; |
sl@0 | 44 |
int priority; |
sl@0 | 45 |
unsigned int reserved1; |
sl@0 | 46 |
unsigned int reserved2; |
sl@0 | 47 |
}_pthread_attr; |
sl@0 | 48 |
|
sl@0 | 49 |
typedef void *(*_START_ROUTINE) (void *); |
sl@0 | 50 |
typedef int (*_START_ROUTINE_SOS) (void *); |
sl@0 | 51 |
|
sl@0 | 52 |
#ifdef __X86GCC__ |
sl@0 | 53 |
// MinGW GCC compiler does not like typedef struct definitions with no tag |
sl@0 | 54 |
typedef struct _wrapperFunArgs_tag |
sl@0 | 55 |
#else |
sl@0 | 56 |
typedef struct |
sl@0 | 57 |
#endif // __X86GCC__ |
sl@0 | 58 |
{ |
sl@0 | 59 |
_START_ROUTINE begin_routine; |
sl@0 | 60 |
void *args; |
sl@0 | 61 |
void *nodePtr; |
sl@0 | 62 |
/******************************************************************* |
sl@0 | 63 |
Overloading new and delete operators so that they will |
sl@0 | 64 |
allocate and deallocare memory from/to the private heap of backend |
sl@0 | 65 |
********************************************************************/ |
sl@0 | 66 |
inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW |
sl@0 | 67 |
{ |
sl@0 | 68 |
Mem::FillZ(aBase, aSize); return aBase; |
sl@0 | 69 |
} |
sl@0 | 70 |
|
sl@0 | 71 |
inline TAny* operator new(TUint aSize) __NO_THROW |
sl@0 | 72 |
{ |
sl@0 | 73 |
return Backend()->Alloc(aSize); |
sl@0 | 74 |
} |
sl@0 | 75 |
|
sl@0 | 76 |
inline TAny* operator new(TUint aSize, TLeave) |
sl@0 | 77 |
{ |
sl@0 | 78 |
TAny* ptr = Backend()->Alloc(aSize); |
sl@0 | 79 |
if (ptr == NULL) |
sl@0 | 80 |
{ |
sl@0 | 81 |
User::Leave(KErrNoMemory); |
sl@0 | 82 |
} |
sl@0 | 83 |
return ptr; |
sl@0 | 84 |
} |
sl@0 | 85 |
|
sl@0 | 86 |
inline TAny* operator new(TUint aSize, TUint aExtraSize) __NO_THROW |
sl@0 | 87 |
{ |
sl@0 | 88 |
return Backend()->Alloc(aSize + aExtraSize); |
sl@0 | 89 |
} |
sl@0 | 90 |
|
sl@0 | 91 |
inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize) |
sl@0 | 92 |
{ |
sl@0 | 93 |
TAny* ptr = Backend()->Alloc(aSize + aExtraSize); |
sl@0 | 94 |
if (ptr == NULL) |
sl@0 | 95 |
{ |
sl@0 | 96 |
User::Leave(KErrNoMemory); |
sl@0 | 97 |
} |
sl@0 | 98 |
return ptr; |
sl@0 | 99 |
} |
sl@0 | 100 |
|
sl@0 | 101 |
inline void operator delete(TAny *aPtr) __NO_THROW |
sl@0 | 102 |
{ |
sl@0 | 103 |
Backend()->Free( aPtr ); |
sl@0 | 104 |
} |
sl@0 | 105 |
}_wrapperFunArgs; |
sl@0 | 106 |
|
sl@0 | 107 |
|
sl@0 | 108 |
|
sl@0 | 109 |
#endif //THREADCREATE_H |
sl@0 | 110 |
|
sl@0 | 111 |
//End of File |