diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-16 21:33:50 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-16 21:33:50 +0900 |
commit | 171c3f96b8a02da15803a739bdb6a2a367527845 (patch) | |
tree | a4f0d97f9325587394e7dacd428293449d526f7d /include/util.h | |
parent | 3fadf1b0d6aa6eb8b5cb302db7fd7a2eadb97488 (diff) | |
download | com-core-171c3f96b8a02da15803a739bdb6a2a367527845.tar.gz com-core-171c3f96b8a02da15803a739bdb6a2a367527845.tar.bz2 com-core-171c3f96b8a02da15803a739bdb6a2a367527845.zip |
sync with master
Diffstat (limited to 'include/util.h')
-rw-r--r-- | include/util.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..0dfa576 --- /dev/null +++ b/include/util.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +extern const char *util_basename(const char *name); + +#define CRITICAL_SECTION_BEGIN(handle) \ +do { \ + int ret; \ + ret = pthread_mutex_lock(handle); \ + if (ret != 0) \ + ErrPrint("Failed to lock: %s\n", strerror(ret)); \ +} while (0) + +#define CRITICAL_SECTION_END(handle) \ +do { \ + int ret; \ + ret = pthread_mutex_unlock(handle); \ + if (ret != 0) \ + ErrPrint("Failed to unlock: %s\n", strerror(ret)); \ +} while (0) + +/* End of a file */ |