mirror of
https://github.com/tezc/sc.git
synced 2025-01-14 06:43:04 +08:00
Documentation (#121)
This commit is contained in:
parent
94aa3c26ad
commit
8888716175
@ -70,7 +70,7 @@
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Term array
|
||||
* Destroy array
|
||||
* @param a array
|
||||
*/
|
||||
#define sc_array_term(a) \
|
||||
|
@ -57,12 +57,16 @@ struct sc_cond {
|
||||
};
|
||||
|
||||
/**
|
||||
* Init cond object
|
||||
*
|
||||
* @param c cond
|
||||
* @return '0' on success, negative on error, errno will be set.
|
||||
*/
|
||||
int sc_cond_init(struct sc_cond *c);
|
||||
|
||||
/**
|
||||
* Destroy cond object
|
||||
*
|
||||
* @param c cond
|
||||
* @return '0' on success, negative on error, errno will be set.
|
||||
*/
|
||||
|
@ -28,6 +28,8 @@ sc_map_dec_strkey(s64, const char *, uint64_t)
|
||||
sc_map_dec_strkey(sll, const char *, long long)
|
||||
```
|
||||
|
||||
If you need more types, you can add at the end of sc_map.h and sc_map.c
|
||||
|
||||
- This is a very fast hashmap.
|
||||
- Single array allocation for all data.
|
||||
- Linear probing over an array.
|
||||
|
@ -86,12 +86,16 @@ struct sc_mmap {
|
||||
int sc_mmap_init(struct sc_mmap *m, const char *name, int file_flags, int prot,
|
||||
int map_flags, size_t offset, size_t len);
|
||||
/**
|
||||
* Destroy mmap instance.
|
||||
*
|
||||
* @param m mmap
|
||||
* @return '0' on success, '-1' on error, call sc_mmap_err() for details.
|
||||
*/
|
||||
int sc_mmap_term(struct sc_mmap *m);
|
||||
|
||||
/**
|
||||
* Sync mmap to the disk.
|
||||
*
|
||||
* @param m mmap
|
||||
* @param offset offset
|
||||
* @param len len
|
||||
|
@ -111,7 +111,7 @@
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Term queue
|
||||
* Destroy queue
|
||||
* @param q queue
|
||||
*/
|
||||
#define sc_queue_term(q) \
|
||||
|
@ -58,11 +58,15 @@ struct sc_thread {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Init thread.
|
||||
*
|
||||
* @param t thread
|
||||
*/
|
||||
void sc_thread_init(struct sc_thread *t);
|
||||
|
||||
/**
|
||||
* Destroy thread.
|
||||
*
|
||||
* @param t thread
|
||||
* @return '0' on success,
|
||||
* '-1' on error, call 'sc_thread_err()' for error string.
|
||||
@ -70,19 +74,26 @@ void sc_thread_init(struct sc_thread *t);
|
||||
int sc_thread_term(struct sc_thread *t);
|
||||
|
||||
/**
|
||||
* Get last error string.
|
||||
*
|
||||
* @param t thread
|
||||
* @return last error message
|
||||
*/
|
||||
const char *sc_thread_err(struct sc_thread *t);
|
||||
|
||||
/**
|
||||
* Start thread.
|
||||
*
|
||||
* @param t thread
|
||||
* @param fn thread function
|
||||
* @return '0' on success,
|
||||
* '-1' on error, call 'sc_thread_err()' for error string.
|
||||
*/
|
||||
int sc_thread_start(struct sc_thread *t, void *(*fn)(void *), void *arg);
|
||||
|
||||
/**
|
||||
* Wait until thread joins.
|
||||
*
|
||||
* @param t thread
|
||||
* @return '0' on success,
|
||||
* '-1' on error, call 'sc_thread_err()' for error string.
|
||||
|
Loading…
x
Reference in New Issue
Block a user