Added a BTokenSpace::SetToken() to assign a specific token.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15111 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -41,6 +41,8 @@ class BTokenSpace : public BLocker {
|
||||
|
||||
int32 NewToken(int16 type, void* object,
|
||||
new_token_callback callback = NULL);
|
||||
void SetToken(int32 token, int16 type, void* object);
|
||||
|
||||
bool RemoveToken(int32 token, remove_token_callback callback = NULL);
|
||||
bool CheckToken(int32 token, int16 type) const;
|
||||
status_t GetToken(int32 token, int16 type, void** object,
|
||||
|
||||
@@ -52,6 +52,22 @@ BTokenSpace::NewToken(int16 type, void* object,
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Inserts the specified token into the token space. If that token
|
||||
already exists, it will be overwritten.
|
||||
Don't mix NewToken() and this method unless you know what you're
|
||||
doing.
|
||||
*/
|
||||
void
|
||||
BTokenSpace::SetToken(int32 token, int16 type, void* object)
|
||||
{
|
||||
BAutolock locker(this);
|
||||
token_info tokenInfo = { type, object };
|
||||
|
||||
fTokenMap[token] = tokenInfo;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BTokenSpace::RemoveToken(int32 token, remove_token_callback callback)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user