freenode/#lisp - IRC Chatlog
Search
8:59:42
fourier
no i dont think so, pthreads doesnt seem to have thread names, I guess these names are sbcl-only
9:12:02
smokeink
yeah same here... hmm what's this https://github.com/sile/taomp-sbcl/blob/master/thread-id.lisp
9:14:30
phoe
and the list of all threads can change at any time, even before the list-all-threads function returns.
9:44:41
smokeink
phoe: I think a solution is to syscall from within sbcl https://stackoverflow.com/questions/19350212/which-linux-syscall-is-used-to-get-a-threads-id using (sb-unix::syscal
9:45:27
smokeink
but I haven't figured out yet how to do that... the syscall examples here are all for Win32api https://searchcode.com/file/5603613/src/code/unix.lisp
9:47:50
phoe
I'll pause this question for now. I'll just break all threads until I see a decrease in CPU usage.
9:49:13
smokeink
I think the TID should be one of the numbers in the TID column this output: ps -To pid,tid -p `pidof sbcl`
9:50:12
smokeink
if not, then it should still be possible to obtain a mapping from the 'crazy number' to the number used by the OS
9:56:03
smokeink
(sb-alien:alien-funcall (sb-alien:extern-alien "getpid" (function sb-alien:unsigned)) ) ; getting close
10:06:48
smokeink
phoe: try this: (sb-alien:alien-funcall (sb-alien:extern-alien "syscall" (function sb-alien:unsigned int )) 224)
10:15:59
smokeink
okay, then you must be using a different system. On my system it works perfectly. Find the gettid syscall code for your system and replace that 224 with it
10:27:10
smokeink
I have no idea.. :) but I think under the hood syscalls are always happening from within the thread
10:30:15
phoe
I can't execute the syscall from outside the thread because it will give me the PID of the thread that executed the syscall.
10:31:15
phoe
Unless we patch SBCL, so it executes that syscall on thread creation and puts its return value inside a new slot in the THREAD structure.
10:31:49
phoe
Which in turn generates issues for multiplatform support, because either it'll be Linux only and therefore ugly, or we do the same for all other platforms that it supports.
10:32:00
smokeink
can you patch the running thread ? and tell it to push its id and its thread-object into some list ?
10:35:51
smokeink
just a random thought: is that thread making the machine run slow? Is it possible to change the priority of a thread and observe whether the machine got faster or not? if so, maybe playing with priorities is a way to find which of the threads is the culprit
10:36:19
phoe
If I go this way, I can (interrupt-thread thread #'break) and see if the CPU usage goes down from 100% to 0%.
11:16:27
smokeink
https://stackoverflow.com/questions/28948415/get-thread-id-in-sbcl/48972801#48972801
11:50:28
smokeink
phoe: that wine/ntdll/server.c get_unix_tid() code is nice. I updated the stackoverflow answer with a get-thread-id that works on windows
11:50:30
Xach
phoe: ironclad's functions are deeply interlinked into a framework. hard to isolate just what you need.
12:00:07
smokeink
phoe: turns out that for Windows a 1 liner is also possible: (sb-alien:alien-funcall (sb-alien:extern-alien "GetCurrentThreadId" (function sb-alien:unsigned)))
12:41:06
scymtym_
C-c C-d d describes the object at point. for symbols, the description usually includes the docstring. this is not automatic, of course. C-c C-d ? lists a bunch of useful functions
12:43:55
oruppert
It would be nice to see not only the argument list in the emacs message area, but also the first line of the docstring.
13:13:06
smokeink
<smokeink> Let's say I have this fib function that breaks when the parameter n equals 2 , https://stackoverflow.com/questions/27889989/stepping-in-sbcl-from-within-the-debugger?rq=1 How to proceed to STEPPING , right after the (break) , without using slime's Return From Frame" (R) and manually typing (fib 2) ? <beach> You probably can't, depending on the Common Lisp implementation you are using.
13:13:16
smokeink
beach: with sbcl and slime, one can just press s after the break took place :) and it will go into stepping mode
13:26:36
Baggers
Is there a reliable way to check if a potential type specifier is valid? I have no use for this just curious. Closest I got was this horrible thing (handler-case (nth-value 1 (subtypep x nil)) (error ())) where x is the specifier
13:26:54
Colleen
Bike: Shinmera said 4 hours, 42 minutes ago: The CCS stuff is not just metadata. It should be visible in the document. The ccsxml should be in the header https://github.com/Shinmera/talks/blob/master/els2018-glsl-oop/paper.tex#L31-L59 and after the abstract should be \printccsdesc https://github.com/Shinmera/talks/blob/master/els2018-glsl-oop/paper.tex#L85
13:50:46
Xach
Baggers: did you update cepl re formatter issue? I wasn't sure on which end it got fixed...
13:51:53
Shinmera
Xach: maybe both. https://github.com/Shinmera/documentation-utils/issues/4#issuecomment-368309280
13:54:44
burton`
If I have a (handler-case .... (error (e) (print e))) form, how do I get the actual error string from the condition 'e', rather than a non-readable representation of the error?
15:56:44
jmercouris
I saw that post on reddit about Lush, and it had me thinking, are there any usable shells written in lisp?
15:58:34
Shinmera
I recall hearing of multiple such projects, but they never really took off because Lisp is a bit verbose for scripting.
16:02:06
jmercouris
I guess it's all relative, I was never good at shell scripting, so I've not had this "succinct" experience
16:02:28
jmercouris
You could ship the shell with a set of macros that make operations like that easier
16:03:34
beach
jmercouris: Oh, you want the syntax to be just like sh or bash, but you want it written in Common Lisp?
16:03:35
jmercouris
What I think would be cool though would be that your "shell scripts" could be written in lisp
16:04:14
Xach
jmercouris: rob warnock wrote about his "OPFR" syntax on comp.lang.lisp from time to time. it was interesting to me.
16:06:00
Shinmera
You can put #!/whatever/dude at the top of a file and the shell will call that executable with the file.
16:48:38
dim
https://gist.github.com/posener/73ffd326d88483df6b1cb66e8ed1e0bd is about Writing Scripts with Go and contains some info about the #! Linux tricks that we might be able to re-use for CL
16:52:51
dim
they play with binfmt_misc to have /usr/local/bin/gorun take care of #! scripts that are *.go
17:15:02
Xach
dim: It's not to illustrate an ideal situation, but a tool in the toolbox that may come in handy
17:16:38
Xach
I had a variation that took advantage of # starting a shell comment and #| starting a multi-line CL comment...something like (short paste a-coming)
17:49:34
shka_
but on the other hand, since pmap blocks thread, it can designate it's home thread for computation
17:51:14
phoe
from what I understand, PMAP should never be put in code that the workers are executing.
17:55:00
phoe
shka_: you can theoretically put calls to parallel functions in there, as long as you redefine *KERNEL* to something else
19:53:09
krwq
what's the most generic specialization for strings in defgeneric? I've tried using just `string` but it seems that when element is #<(SIMPLE-ARRAY CHARACTER (3)) {10099D919F}> this doesn't worl
20:07:10
krwq
is there a way to force errors when generic functions are created implicitly when defmethod is used?
20:08:58
fourier
fe[nl]ix: I've fixed that you've requested in osicat pull requests(there are 2 from me), but there is something strange on travis - sbcl unable to install.. I guess