forked from HardySimpson/zlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread.h
More file actions
67 lines (56 loc) · 1.82 KB
/
Copy paththread.h
File metadata and controls
67 lines (56 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* Copyright (c) Hardy Simpson
*
* 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.
*/
#ifndef __zlog_thread_h
#define __zlog_thread_h
#include <stdatomic.h>
#include <stdbool.h>
#include "zc_defs.h"
#include "event.h"
#include "buf.h"
#include "mdc.h"
/**
* zlog_thread_t -
*
* @producer: used with writer thread
*/
typedef struct zlog_thread_s {
int init_version;
zlog_mdc_t *mdc;
zlog_event_t *event;
/* change per conf start */
zlog_buf_t *pre_path_buf;
zlog_buf_t *path_buf;
zlog_buf_t *archive_path_buf;
zlog_buf_t *pre_msg_buf;
zlog_buf_t *msg_buf;
/* change per conf end */
struct {
/* change per conf start */
bool en;
atomic_int refcnt;
/* change per conf end */
unsigned int full_cnt;
} producer;
} zlog_thread_t;
struct zlog_conf_s;
struct zlog_process_data;
void zlog_thread_del(zlog_thread_t * a_thread);
void zlog_thread_profile(zlog_thread_t * a_thread, int flag);
zlog_thread_t *zlog_thread_new(int init_version,
size_t buf_size_min, size_t buf_size_max, int time_cache_count, struct zlog_conf_s *conf);
int zlog_thread_rebuild_msg_buf(zlog_thread_t * a_thread, size_t buf_size_min, size_t buf_size_max);
int zlog_thread_rebuild_event(zlog_thread_t * a_thread, int time_cache_count);
void zlog_thread_rebuild_producer(zlog_thread_t * thread, bool en);
#endif