我们可以使用纯html5访问服务器端数据库(即不使用PHP,ASP ....或任何其他后端语言)?我们可以使用web sql数据库,但它存储在客户端.我需要访问服务器端数据库(可能是mysql或任何其他).
我完整的perl脚本是
chdir ("/etc" or die "cannot change: $!\n");
print "\nCurrent Directory is $ENV{PWD} \n";
Run Code Online (Sandbox Code Playgroud)
我得到了输出(不是预期的)
bash-3.2$ perl test.pl
Run Code Online (Sandbox Code Playgroud)
当前目录是 /home
PS /home
是我执行的地方test.pl
即使主进程退出,此代码中的子线程也会阻塞shell.如何让它在后台运行而不阻止shell?我认为这是可能的fork()
,但我不想创建一个全新的过程.
谢谢.
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void * myThreadFun (void *vargp)
{
while (1)
{
//Do useful work continuously
sleep (1);
}
}
int
main ()
{
pthread_t tid;
pthread_create (&tid, NULL, myThreadFun, NULL);
pthread_detach (tid);
printf ("After Thread\n");
pthread_exit (0);
}
Run Code Online (Sandbox Code Playgroud)