Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: java/src/org/apache/tomcat/jni/Lock.java

Issue 2842333002: Updated netty-tcnative to version 2.0.0.Final (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « java/src/org/apache/tomcat/jni/Local.java ('k') | java/src/org/apache/tomcat/jni/Mmap.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.apache.tomcat.jni;
19
20 /** Lock
21 *
22 * @author Mladen Turk
23 */
24 public class Lock {
25
26 /**
27 * Enumerated potential types for APR process locking methods
28 * <br><b>Warning :</b> Check APR_HAS_foo_SERIALIZE defines to see if the pl atform supports
29 * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
30 */
31
32 public static final int APR_LOCK_FCNTL = 0; /** fcntl() */
33 public static final int APR_LOCK_FLOCK = 1; /** flock() */
34 public static final int APR_LOCK_SYSVSEM = 2; /** System V Semaphores * /
35 public static final int APR_LOCK_PROC_PTHREAD = 3; /** POSIX pthread process -based locking */
36 public static final int APR_LOCK_POSIXSEM = 4; /** POSIX semaphore proce ss-based locking */
37 public static final int APR_LOCK_DEFAULT = 5; /** Use the default proce ss lock */
38
39 /**
40 * Create and initialize a mutex that can be used to synchronize processes.
41 * <br><b>Warning :</b> Check APR_HAS_foo_SERIALIZE defines to see if the pl atform supports
42 * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
43 * @param fname A file name to use if the lock mechanism requires one. This
44 * argument should always be provided. The lock code itself will
45 * determine if it should be used.
46 * @param mech The mechanism to use for the interprocess lock, if any; one o f
47 * <PRE>
48 * APR_LOCK_FCNTL
49 * APR_LOCK_FLOCK
50 * APR_LOCK_SYSVSEM
51 * APR_LOCK_POSIXSEM
52 * APR_LOCK_PROC_PTHREAD
53 * APR_LOCK_DEFAULT pick the default mechanism for the platfo rm
54 * </PRE>
55 * @param pool the pool from which to allocate the mutex.
56 * @return Newly created mutex.
57 */
58 public static native long create(String fname, int mech, long pool)
59 throws Error;
60
61 /**
62 * Re-open a mutex in a child process.
63 * This function must be called to maintain portability, even
64 * if the underlying lock mechanism does not require it.
65 * @param fname A file name to use if the mutex mechanism requires one. Thi s
66 * argument should always be provided. The mutex code itself w ill
67 * determine if it should be used. This filename should be the
68 * same one that was passed to apr_proc_mutex_create().
69 * @param pool The pool to operate on.
70 * @return Newly opened mutex.
71 */
72 public static native long childInit(String fname, long pool)
73 throws Error;
74
75 /**
76 * Acquire the lock for the given mutex. If the mutex is already locked,
77 * the current thread will be put to sleep until the lock becomes available.
78 * @param mutex the mutex on which to acquire the lock.
79 */
80 public static native int lock(long mutex);
81
82 /**
83 * Attempt to acquire the lock for the given mutex. If the mutex has already
84 * been acquired, the call returns immediately with APR_EBUSY. Note: it
85 * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
86 * if the return value was APR_EBUSY, for portability reasons.
87 * @param mutex the mutex on which to attempt the lock acquiring.
88 */
89 public static native int trylock(long mutex);
90
91 /**
92 * Release the lock for the given mutex.
93 * @param mutex the mutex from which to release the lock.
94 */
95 public static native int unlock(long mutex);
96
97 /**
98 * Destroy the mutex and free the memory associated with the lock.
99 * @param mutex the mutex to destroy.
100 */
101 public static native int destroy(long mutex);
102
103 /**
104 * Return the name of the lockfile for the mutex, or NULL
105 * if the mutex doesn't use a lock file
106 */
107 public static native String lockfile(long mutex);
108
109 /**
110 * Display the name of the mutex, as it relates to the actual method used.
111 * This matches the valid options for Apache's AcceptMutex directive
112 * @param mutex the name of the mutex
113 */
114 public static native String name(long mutex);
115
116 /**
117 * Display the name of the default mutex: APR_LOCK_DEFAULT
118 */
119 public static native String defname();
120
121 }
OLDNEW
« no previous file with comments | « java/src/org/apache/tomcat/jni/Local.java ('k') | java/src/org/apache/tomcat/jni/Mmap.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698