Skip to content

Commit 354df60

Browse files
committed
Support set specifics for any thread.
1 parent 8c3e89a commit 354df60

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ The branch [srs](https://github.com/ossrs/state-threads/tree/srs) was patched an
117117
- [x] IDE: Support CLion for debugging and learning.
118118
- [x] Define and use a new jmpbuf, because the structure is different.
119119
- [x] Check capability for backtrack.
120+
- [x] Support set specifics for any thread.
120121
- [ ] System: Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).
121122

122123
## GDB Tools

key.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ int st_key_getlimit(void)
7979
int st_thread_setspecific(int key, void *value)
8080
{
8181
_st_thread_t *me = _ST_CURRENT_THREAD();
82-
82+
return st_thread_setspecific2(me, key, value);
83+
}
84+
85+
86+
int st_thread_setspecific2(_st_thread_t *me, int key, void *value)
87+
{
8388
if (key < 0 || key >= key_max) {
8489
errno = EINVAL;
8590
return -1;

public.h

+2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ extern int st_sendmsg(st_netfd_t fd, const struct msghdr *msg, int flags, st_uti
156156

157157
extern st_netfd_t st_open(const char *path, int oflags, mode_t mode);
158158

159+
extern int st_thread_setspecific2(st_thread_t thread, int key, void *value);
160+
159161
#ifdef DEBUG
160162
extern void _st_show_thread_stack(st_thread_t thread, const char *messg);
161163
extern void _st_iterate_threads(void);

sched.c

-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ _st_thread_t *st_thread_self(void)
689689
return _ST_CURRENT_THREAD();
690690
}
691691

692-
693692
#ifdef DEBUG
694693
/* ARGSUSED */
695694
void _st_show_thread_stack(_st_thread_t *thread, const char *messg)

0 commit comments

Comments
 (0)